« first day (3786 days earlier)      last day (1145 days later) » 

Air
12:04 AM
a hearty "my cabbages!" to you all
it only took 2 years and a bit for my IT department to fail so consistently and completely that I am once again allowed to make-a the code
 
 
3 hours later…
2:50 AM
Let's say I have a tensor consisting of 1 and 0's as shown below. How can I get the index of a specific column to replace with new values ? If I want to replace the values of column 1 with the [3.,4.,5.,6.], how do I accomplish this ?

a = torch.tensor([[[1., 0., 0., 0.]],
[[0., 1., 0., 0.]],
[[1., 0., 0., 0.]],
[[0., 0., 0., 1.]],
[[1., 0., 0., 0.]],
[[0., 0., 0., 1.]],
[[1., 0., 0., 0.]]])
 
 
3 hours later…
6:07 AM
when there are multiple good answers to a question (not mine), is it useful to leave a comment on the one or two that you think are ideal and why they're ideal? like as a pointer to someone learning? (ie the questions and answers aren't mine; just happened read through them.)
 
7:05 AM
cbg folks
well ideally let the upvotes do their thing. but yeah i dont see a direct issue with comments like that personally, just that comments arent expected to be permanent and perhaps they too would eventually become falsey
so i'd say exercise caution and be stingy with comments like these perhaps
this will hopefully become less of an issue once we get something concrete for depreciating answers that gained a lot of upvotes in the past but became out of date over time
for the rest, upvotes really should be what we rely on.
 
 
1 hour later…
user13727121
8:21 AM
is it a good practice to declare variables in a conditional statement if I'll only be using it within the statement?
 
@CoreVisional declare? in general, initialise variables just before you'll use them - and it's fine if they only exist in a for-loop or if-block. in Python, declaring default/initialisers at the top of a function or method and using them only later is considered confusing. even in C/C++, the trend has moved to declaring variables just before usage. otherwise, future readers may have to scroll pages until they find what that variable was originally initialised to
exception: in classes (for Python 3.3+ iirc), make sure to initialise all attributes in __init__. there was some optimisation done for class dicts that only works if all the attributes ever used are in init.
 
8:38 AM
Even leaving aside optimisations, an instance should still have all attributes once __init__+__new__ complete. The point of a class is to encode the capabilities of its instances; if some capabilities/attributes are only available at a later, arbitrary point then knowing the class looses much of its advantage.
Many of the notoriously hard to use modules are heavy on such incomplete objects. Working with socket can be an eye-opener.
 
@CoreVisional can you show an example?
 
@MisterMiyagi yes, I meant init is an exception to what I'd said about "declare just before using". the optimisations is a side-note.
 
user13727121
@aneroid I uhhh.. haven't learned about classes, thanks for clarifying, I wasn't sure if I should initialize it first or when I'm gonna use it
 
so to summarise:
1. in functions or methods, declare/initialise just before using
2. in classes, declare all attributes in `__init__` (or split between `__new__` and `__init__`)
 
8:58 AM
it maybe worth pointing out that a variable created inside a loop will be available outside the loop as well in python, I had trouble with this after learning C for 2 days :D, when I was learning to code
 
user13727121
@python_user I have mine created inside the loop, it's a...I think it's called a "flag" variable?
 
user13727121
9:17 AM
I have an example here: dpaste.com/7EMX5Q8JS
 
user13727121
is it a good practice to initialize it inside a while loop
 
yes
 
yes
 
Wait, if you're talking about defining the flag variable inside the 2nd loop then no. That wouldn't work correctly
 
user13727121
Ahh alright, i remember someone told me it's slow if the variable is declared inside conditional statement...
 
user13727121
9:21 AM
@Aran-Fey hmm, it works on my end. Or is it not a good thing to do it like that
 
@CoreVisional the way you have it in the link is what we said "yes" to
@CoreVisional that's a very confusing statement that must have only made sense in context (and maybe it was wrong entirely)
 
user13727121
oh sorry, I misread, I forgot that I have 2 while loops and @Aran-Fey mentioned if the variable defined in the 2nd while loop, it wouldn't work. I was looking at the first while loop, so sorry
 
Hello, i am a new one
What do you guys do
here
 
9:52 AM
aaand he's gone
 
whatever we do, seems it's not immediate enough for their taste ^^
 
I have a column in pandas with strings which contains only A, C, G, and T. I want to remove A and T
With my code all output lines are the same.
But the input is different
 
re.sub doesn't know what a pandas dataframe is.
Use pandas' own methods instead.
 
Hey guys just want to ask for some leads on some web automation tasks
There are some reports I need exported from a website but i'm not sure which URL I should make requests from
 
10:11 AM
@MisterMiyagi Thank you
 
I tend to re-download everything time to time since sometimes there are some changes even for older files so it is quite tedious to do so. There is no built in feature to download all statements between a date range so the only option is to have a script that can do something similar. My friend said it was possible to do so even with this kind of layout of the web page. But I am hoping for some leads such as with libraries/elements I should look into
Should selenium be something i should look into for this?
beautiful soup or just simply requests?
 
@MisterMiyagi This is also not working
df2['dnaseq'] = df2['dnaseq'].map({'A': '', 'T': ''})
all values are turned into NaN
 
@kame I think you are looking for .str.replace
IANAP, though.
 
I tried this
But it was not working
df2['dnaseq'] = df2['dnaseq'].replace({'A': '', 'T': ''})
no change
 
.replace is not .str.replace
 
10:21 AM
@MisterMiyagi fake news
 
10:43 AM
if you have a dictionary , .replace should work , I think you may need regex=True for matching partial words.
 
10:56 AM
@AndrasDeak I prefer "p-value deficient information"
 
user13727121
11:31 AM
it's a stupid question but uhh, is it better to break after else or use break before that. Example: dpaste.com/2HL6BG9KU
 
I don't think either is "better" as far as break is concerned.
When a loop has a lot of iterations to do, placing the most likely branch at the top has some performance benefits. But that is a case of measuring, not guessing.
 
IMO putting the break near the top is marginally better
 
This is working
df2['dnaseq'] = df2['dnaseq'].str.replace('[AT]', '', regex=True)
 
 
2 hours later…
1:47 PM
Hi, do somebody know where I could find some data science exercises?
 
@kame things like kaggle come to mind
 
@AndrasDeak kaggle looks interessting. do you know a data scientists community?
 
nope
 
2:25 PM
Can anyone recommend me an easy language that's easy to compile into a native exe (no runtime required)? I don't want to use python because those packaged exes are awfully slow to start up. I need to make a bunch of HTTP requests, read an exe file's metadata, extract a zip file, and replace a bunch of files
Also I can potentially get paid to learn a new language :D
 
C? :P
the task at hand restricts the options a lot; they are fairly complex tasks
 
True. I'll probably end up using python, as usual...
This isn't the first time I have this problem, so maybe I should just try and convince my boss to install python everywhere...
 
seems good
 
And then, in the not-so-distant future, 5 IT guys later, all PCs will have python, Java, C++, .NET, perl, and Go installed
 
well it wouldn't really hurt much
people only use solitaire and facebook anyway
 
3:06 PM
@Aran-Fey Not a fan, but Golang probably fits like a glove for the task.
If you don't mind a slightly longer learning phase, pick Rust.
The only reason I'm not using it more is that we do have Python on all our machines...
 
@MisterMiyagi the dream! you just wanted to flex on us, didn't ya :P
 
Yeah, I also have python on all my machines and you don't see me bragging about it
 
@ParitoshSingh shocking twist: it's all Python 2.7!
 
groan i, uh..no longer envy you.
 
@AndrasDeak perhaps you should. People could point their bosses at room/6 and say: But Andras does have Python on all his machines!
 
3:16 PM
@MisterMiyagi Scientists? Not that shocked.
 
Science. Rejecting asspressions before it was cool.
 
@MisterMiyagi Are you sure it's only slightly longer? Then I'm actually tempted to try Rust instead
 
I've found the compiler to be very helpful in nudging you along. The official docs are also pretty great. The major problem is that libraries are still sparse; might want to check whether there is something for all you need beforehand.
 
Alright, thanks
 
 
3 hours later…
6:02 PM
Anyone here?
 
nope
 
can confirm
 
6:24 PM
echo
 
/-:
 
said The listener- knocking the door
 
inb4 [edit to listener]
 
closed as typo :P
 
lol
 
6:31 PM
I shouldn't have edited that.. anyway
@byggmesterPRO please continue..
 
Air
Maybe that was their only relevant question
Maybe the room has indelibly corrupted their survey data by answering facetiously
 
laurel
Friday cbg bdw
 
Air
chag purim sameach as applicable
informal survey... do y'all prefer to keep your database config out of source by loading them from environment variables, or in some other manner?
 
7:21 PM
Hey guys
I'm new here
Anybody use repl.it?
 
7:33 PM
rbrb
 
rarely
 
 
1 hour later…
9:00 PM
Holy yam! It's been a while since I've set up Python on windows. I insisted on using Anaconda but a number of conda packages break on windows where I had to uninstall them via conda uninstall numpy --force and reinstall with pip install numpy
Had to do that with Numpy and Scipy. I was annoyed
 
I'm told that just taking python and pip installing the scipy stack might Just Work now, if memory serves
 
I'll try that later.
 
or perhaps I'm remembering the wrong way around
Dec 29 '18 at 0:31, by roganjosh
The scientific stack (like scipy, mainly IIRC) can cause serious headaches. Anaconda just shuts the whole thing away. Why would you want to avoid Conda here? Too large?
 
I'm all good at the moment
 
no, I was right
Dec 3 '20 at 20:47, by roganjosh
When I first started, I didn't really understand what compilation issues were going on with Pandas on Windows and the approach then was "just use Conda, it's easier". So I did. Recently I installed the whole scientific stack on Windows 10 in a regular virtualenv and it went without issue, so I don't see why I need conda
 
9:03 PM
Yeah, it was weird. I could run scripts just fine. Only when I used Jupyter did it yam the bed
I'm reluctant to click it
 
you don't have to
 
for a week now it has been taunting me. Come now AD you know that I was a FGITW when I started and I had to get my dopamine hit as often as possible. It's like seeing my old dealer after a long time. I don't know how to tell them "no" politely so I'm ignoring that they are there.
 
I know :P
I'm sure there's a userscript that hides it
 
9:20 PM
Crazy how expensive PC parts are right now. Really bad time for my graphics card to break :(
 
yikes, sorry
I recently sold a used RTX 2080 Super for $500 and this was AFTER the 3080's were "released"
Also, anyone else Use "FancyZones" in Microsoft's PowerToys set of tools? It's actually really great. docs.microsoft.com/en-us/windows/powertoys/fancyzones
 
Holy cow that's a good card
@piRSquared Ha, I can't even remember the last time I had two windows open on the same desktop!
 
I've got way too many open and each has to have some real estate
 
sounds like a tiling window manager
 
it is that exactly
 
9:34 PM
ah, right, windows ;)
 
Air
When installing a package via pip, is there some way to tell beforehand what dependencies are going to come along with it? Other than hoping it's clearly described in that package's documentation?
Maybe I need to look at the .whl?
 
Look inside the setup.py or pyproject.toml I guess
Or use wim's johnnydep
That reminds me, I should probably do my regular google search for an actual good multi-desktop program for Windoze again. Been a while since the last one
Leave it to Microsoft to steal a feature that linux has had for decades and do it so badly that it's practically unusable
 
Air
Django's pyproject.toml only lists setuptools and wheel, but pip installs several other libraries alongside it
curious
 
Check the setup.cfg
 
Air
yeah just got to it
 

« first day (3786 days earlier)      last day (1145 days later) »