« first day (3701 days earlier)      last day (1230 days later) » 

12:23 AM
I might be crazy, but I ran code in one notebook, literally transferred the same code to another file in the same directory and it won't work the same
it outputs nothing
 
Just saw this issue: windows update breaks numpy developercommunity2.visualstudio.com/t/…
 
12:45 AM
Also: so many "solutions" posted on that thread.....
 
1:23 AM
Good news: found a DenverCoder9 with the exact problem I'm having. Bad news: after finding the solution himself, he said he was an idiot, so by the transitive property he is also calling me an idiot.
Don't be so hard on yourself and transitively me, DenverCoder9. "%1 is not a valid win32 application" is hardly a trivial error message.
 
 
1 hour later…
2:26 AM
cbg all, I need a clarification, a class (Foo) instance works fine when I do {Foo()} but stackoverflow.com/a/7152650/12502959 tells me I have to implement __hash__ and this is the same for py 2 and 3, can anyone explain me this
class Foo:... is all my class definition is
 
 
1 hour later…
3:48 AM
look here @python_learner
 
thats what I needed, thanks :)
 
 
5 hours later…
8:24 AM
the removed message still shows up in my notification :p
 
Yeah, it's weird. It even shows which message it was directed to when hovering over it. oO
 
8:52 AM
I guess that might be for moderation purpose in case some user deletes something
 
user14596741
9:04 AM
Guys where can i find github official Identicon algorithm?
Although found alot of algorithm for Identicon, I need github official one?
Anybody knows?
 
9:29 AM
Hey guys am I alright to remove the pycache files in the directory if they are creating problems with pushing to git?
or will it screw the app that I am working on?
 
removing pycache is fine
though you might want to fix your git workflow instead
 
thing is i am not really sure why that has happened just keepo receiving this
git commit -m " added check students and remove route"
error: invalid object 100644 dd2812b7448c7a45720cf5e9d1d2a7df33eb7193 for 'app/auth/__pycache__/__init__.cpython-38.pyc'
error: invalid object 100644 dd2812b7448c7a45720cf5e9d1d2a7df33eb7193 for 'app/auth/__pycache__/__init__.cpython-38.pyc'
error: Error building trees
have tried replacing previous pycach folders with ones from the repo, however when running another pycache in a different location with the .cpython-38.pyc name shows up i am not sure if it is just the entire lot with the cpython-38.pyc that are the problem
not quite sure why this has even happened
 
pycache shouldn't be tracked with git in the first place.
 
Yeah, .gitignore is your friend
 
@MisterMiyagi did not know this well if that is the case im going to remove them off the tracking and go with this solution and see if this helps
 
9:33 AM
@Kwsswart it happened with git add .
 
why would git add . cause that
 
@Kwsswart why would it not?
"Git,, add EVERYTHING". "OK, adding everything" "How did this happen? :'|"
 
Realising that the machine does what you tell it to is an important step towards being a senior WTF'er.
Even when it appears the machine does magic, that's because you told it to do so.
 
Makes sense I think some times I need to think a bit more before just doing lol :/
However seems to be alot more serious than just pycache something is up with repo may need to refresh it
 
9:57 AM
cbg
 
10:51 AM
Hey guys,
is there a way to "safely" get an item of a list
given
l = [1,2]
l[2]
>> 1
 
What is the expected output if not an error?
Or do you mean the index should wrap around?
 
Wrap around, I want if I go to index 3 in my example to get the 1st element, since my list only contains 2 elements
So if im out of range, start over at index 0
 
@0x45 OK, that's not what "safely get" normally means. Hearing that I'd expect None for an invalid index
@0x45 l[i % len(l)]
 
Sorry... I dont know how to explain it so im quite lost googling it
ha! Nice that was my approach just now too :D
l[4 % 2 -1]
but -1 required right?
cuz 0 based?
 
@0x45 easy enough to test
 
10:55 AM
Thanks :)
 
any chance you are doing advent of code? 0x45
 
Yes :)
 
needed this in today's question
 
:D
i didnt want toe xtend the input
so I just go back to beginning
 
there's also an Advent of Code chatroom
no spoilers here (or there, for that matter)
 
11:05 AM
oh
 
to your right is a star board (if on desktop), the one with 9 stars has the link to that room
 
 
1 hour later…
12:36 PM
@AndrasDeak also git rm -rf __pycache__ ?
@Kwsswart If you aren't sure what will be committed. git status is your friend.
 
Hi! Does anyone have a website or any advice on how to learn coding in python? I want anything similar to codeacademy but for free (where I´m supposed to code and not see another one code and where the right answers can be shown if I don't know how to do)
 
@Rezaamin Did you work through the Python tutorial already?
 
12:51 PM
@MisterMiyagi no sir
 
1:33 PM
good morning cabbages folks!
 
2:01 PM
Current mood: coal miner who just noticed he hasn't heard his canary in a while
I'm four XY problems deep and this innocuous operation is segfaulting. I knew I should have been a lumberjack.
 
Good morning. Does anyone here use Pycharm with Vim keybindings? I'm looking for a way to keep the Vim keybindings when I go from the editor to the console.
 
realises he hasn't heard his rubber duck in a while
 
Haven't heard my Skull of Regret in a while, he's usually pretty vocal this time of day
Ah, it wasn't switched on. Here we go...
[click]
"YOU FORGOT TO LEARN C LIKE YOU SAID YOU WOULD"
 
Only thing to regret is allowing that door-to-door salesman a chance to talk me into buying that stupid skull of regret
 
95% of the time it just mentions ill-advised things I did in high school, but sometimes it notices logic errors in my code, so it's still a net gain
 
2:16 PM
I never made a single mistake in high school so not so much for me
 
Impressive
 
Haha, if that were true the net gain would be more significant, not less. Now the skull of regret is yelling at me
 
One might argue that not making any mistakes in high school is itself a mistake because it deprives you of the important learning experience of recovering from mistakes, in an environment which is less high stakes* than adult life
(*results may vary, depending on whether you were in the kind of clique that would disown you for wearing the wrong color shirt or whatever)
 
I regret trying to understand a program that declares the CLI parameters -a, -b, -c, -d, ... :/
 
@MisterMiyagi So the short version of the flag is not the first letter of the flag itself, or related? Yeah that might make things a bit obscure.
Or are you saying that is what you get with --help, either way it's not good
 
2:35 PM
There's only the short version. D:
 
user13415013
3:07 PM
:)
 
3:30 PM
Idle thought: I wonder how hard it is to generate wireframe data if you have the formula for an arbitrary parametric surface. In particular I'm thinking about finite surfaces like spheres and toruses. Even if you know that the formula is periodic for some particular ranges of u and v, you don't necessarily know how the borders stitch together.
 
@nerd it's pretty distracting that you keep oscillating between accounts
@Kevin if you know the parameter ranges it should Just Work, should it not?
 
Streaming Advent of Code day 3 now, then finishing work on type hints for Werkzeug: twitch.tv/davidism
 
Like, a torus is easy, you know that f(u=n, v=0) is equal to f(u=n,v=2*pi) for all valid n, which means the ends overlap quite easily. But I think for a mobius strip, it's something like, f(u=n, v=0) is equal to f(u=-n, v=2*pi) because it does a half twist in the middle
I suppose you could do a guess-and-check approach and go over the various common ways of connecting boundaries, which would probably be good enough for simple formulas
 
@Kevin if you include both ends it connects automatically
Both v=0 and v=2pi
 
3:47 PM
Hmm
 
@Kevin You guys went to high school? When I were a lad ... [drifts into Yorkshiremen sketch from the Secret Policeman's Ball]
 
I found an interesting post: lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate Not python related, but people might be interested
 
@Kevin Aren't there established finite element approaches to that problem?
There must be some really interesting corner cases.
 
I think there are a finite number of solutions if you make certain assumptions about the boundary
but for arbitrary surfaces, I'm not so sure -- for instance, you could define an arbitrary number of torus-like surfaces except they have a half twist or a quarter twist or a 1/2^N twist for any natural N
Or even for real N
I do think there's a branch of math that investigates the ways that you can join up the edges of a square, I just can't remember the name
I remember it had diagrams like this one, where you form shapes by bending the square so the colored arrows line up
Here's the one for a klein bottle: en.wikipedia.org/wiki/Klein_bottle#/media/…
I think I'm thinking of Fundamental polygon, although it looks like it doesn't trivially generalize to surfaces with abrupt boundaries like the mobius strip
 
user13415013
4:26 PM
:)
 
I think if we allow unjoined edges, then the total possibilities are sphere, real projective plane, klein bottle, torus, square, cone, mobius strip, cylinder
Every formula with a finite range should be topologically equivalent to one of those. I'm currently trying to think of a counterexample... Is there a formula for a double torus?
math.stackexchange.com/questions/108998/… says no, in which case it doesn't count
So in my hypothetical surface rendering program I could just force the caller to supply a value out of the topological equivalents enum. I could live with that.
It occurs to me that this is a lot of work just to ensure I don't accidentally have two points with identical coordinates (or near-identical if floats are involved), which would be 100% impossible for the end user to notice (or 99.9999% impossible if floats are involved)
But if I don't care about things that don't matter, who will?
 
5:09 PM
are there other python/python library core devs like davidism that stream?
I didnt know I liked to watch coding streams till now
I watched only a couple mins but still better than watching angry "gamers"
 
Good question. The only coding streamer I watch with any regularity is the dev of Baba Is You. He doesn't work with Python.
 
is that a name of the game? my google searches lead to a game
 
Yeah
 
I just want to watch these so I can know how an actual dev thinks, how he or she refactors stuff live
 
5:24 PM
There are quite a few coders on Twitch, but I don't see an obvious way to filter by programming language or field of study
Not that watching a python core dev develop python would make you better at python, because they'd mostly be writing C
 
I didnt even think about that
the video with the most views on that page is a leetcode question :D
 
On the other hand, many programming skills transcend the semantics of programming languages, so it doesn't matter much which one the streamer is using as long as you can follow along
 
IIRC he is some top competitive programmer, glad to know he didnt buy leetcode premium
I only understand python to follow along, considering I have to also put some effort to understand the English they speak (not a native)
 
Whenever I watch code streams, I can't focus well enough to learn anything. It's more like "typing and complaining about the buggy IDE" ASMR
 
laurel, its the coder equivalent of a lag I guess
rbrb guys
 
5:35 PM
Reminds me of the only semester in college where my roommate was also a CS major. Five minutes to midnight and he's muttering about his assignment's failing test cases
Meanwhile I'm playing Minecraft because I sagely finished my assignment at fifteen minutes to midnight
Of course the other half of the time he would finish first and then blast Caramelldansen at maximum volume to taunt me. Good times.
 
6:19 PM
@davidism Sounds interesting! Let's hope you're still doing this in a week or so when I have a real opportunity to watch
 
Hi everyone. I have a quick question about how panda's drop NA works. I am specifically following this question:stackoverflow.com/questions/39128856/…
I tried their example and am confused why setting thresh=1 does not remove a row where one of the columns have 1 NA
 
@Kevin the question asks how to remove if there are 2 or more NAs. So presumably thresh=1 means "1 NA is still OK, only remove 2 or more"
I haven't checked the docs yet. Have you?
 
threshint, optional
Require that many non-NA values.
 
so the way I looked at it if thresh=1 thats how many NAs have to appear before dropping
like if I set thresh=2 if a row has 2 columns as na drop it
 
6:30 PM
that's what the docs and the code sounds like
let me look at the git blame
except github's UI croaks on the blame of such a large file, ugh
 
Okay, I think I understand what they mean. I must have just misread it. If thresh = 1, 1 na is okay to keep row
as you stated
 
@Kevin are you assigning the result back/doing it inplace?
 
@Kevin but that's not what the code seems to be doing
 
I am just printing the results of the operation for right now before I apply it to my DS
 
What is the dtype of that column in which you see the NA value?
 
6:34 PM
@roganjosh float64
 
OK, based on git blame it always did >= thresh
 
I assume if I set thresh=0 it means if any column in that subset has an NaN it will drop, thresh=1 if one is NaN but rest are not it wont drop the col
row*
except if I set thresh=0 it does not drop rows that have any of them NaN
 
I can reproduce it
 
if you set thresh=0 does it eliminate the rows that have any of them nan
setting thresh=1 certainly allows you to have 1 or less NaNs in the subset, setting thresh=2 allows for 2 nans
if I do: df.dropna(subset=['a','b','c'], thresh=1)
where a, b, and c are 1,2, and 3 respectivly
 
Ah, no, hold on. The thresh is for non-NA values
 
6:45 PM
hrmm, the docs say "Require that many non-NA values."
 
If you take a subset of columns and it only contains 2 columns... then the count of the _non_NA value will be the one that matters, and indeed that matches the threshold of 1
 
ah, ok, so essentially its the non-NA values i.e if you have 1 value and rest are NA then keep it?
if thresh=1
Thanks, I think I understand it now
 
The count is made here. It doesn't matter that there is 1 of each (NA or value), there need only be 1 non-NA value for the thresh check below that line of code to be True
 
@roganjosh thanks again. I now understand how it works
 
FWIW I think that's backwards to my intuition. Normally I'd want to specify the count of the NA values and not care how many columns there are
 
6:50 PM
agreed Thats how I originally thought (and would make sense as we have to take the length of the subset into account)
 
@roganjosh heh
that's completely wrong (the design I mean)
 
Tempted to submit a PR to that effect; I'm sure it wouldn't break too much code :P I'll probably fix the pd.DataFrame.where logic at the same time
 
7:07 PM
Hypothesis: checking something is np.NaN might carry some overhead since it, by definition, doesn't compare equal to itself. So there might be a minor speed gain by checking for something other than nan that motivates "backwards" logic in both methods. But my code shows that it's actually slower to approach from that angle. Is my test fair?
arr = np.random.choice(list(range(100)) + [np.nan], 1000000)

def is_nan(arr):
    return np.isnan(arr)

def is_not_nan(arr):
    return ~np.isnan(arr)
 
@roganjosh Do you mean you expect the second function to be faster?
 
Or maybe ~np.isnan() isn't clear enough to indicate a different code path could even be taken and it just flips the result at the end
@AndrasDeak Yeah. I'm just curious why there's multiple methods that seem to be set up in the reverse to "common sense"
 
not sure what your point is
@roganjosh because your and my common sense might not overlap with the dev's common sense
 
Sure, that seems to be the case. I just wanted to see if there might be some firmer basis. Seems not
 
numpy nan is a single object, you just check identity
 
7:12 PM
I guessed that was also the case. I could have just looked up whether it was a singleton like None but, oh well
 
floating point nans are pretty easy to check for if you have bit-level access
 
@roganjosh it's a specific instance of float nan. If you do np.potato = ... then np.potato is the same object until you reassign it
@Kevin also x != x is a reasonable nan check
 
True, I'm just pondering close-to-the-metal approaches
 
Yeah, there's probably an IEEE thing for isnan
 
en.wikipedia.org/wiki/NaN suggests that NaNs and only NaNs follow the specific pattern of "an arbitrary sign bit, followed by X one bits, followed by however many bits of whatever value"
where X varies depending on whether it's double or a single etc
I'd like to cite chapter and verse from the IEEE doc itself, but alas I don't have $140 handy
Correction: "however many bits of whatever nonzero value". If it's all zero bits, that makes it an inf.
 
7:37 PM
The specifics are a bit beyond me but it looks like that assembly languages with floating point instructions will set a flag indicating nanness. For example FCOM
So if you're really close to the metal, you don't even need to do bit arithmetic, because the FPU did it already
 
8:35 PM
@Kevin I checked what numpy does
/*
 * IEEE 754 fpu handling. Those are guaranteed to be macros
 */

/* use builtins to avoid function calls in tight loops
 * only available if npy_config.h is available (= numpys own build) */
#if HAVE___BUILTIN_ISNAN
    #define npy_isnan(x) __builtin_isnan(x)
#else
    #ifndef NPY_HAVE_DECL_ISNAN
        #define npy_isnan(x) ((x) != (x))
    #else
        #if defined(_MSC_VER) && (_MSC_VER < 1900)
            #define npy_isnan(x) _isnan((x))
        #else
            #define npy_isnan(x) isnan(x)
 
I have a strange error. Even though I ran "pip3 install scipy" and it seems to be successfully installed, when I try to import it I get "ModuleNotFoundError: No module named 'scipy'".
 
your python and pip3 correspond to different environments
 
$ python3 --version
Python 3.8.2
$ pip3 --version
pip 20.3 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)
Does that seem right?
 
@user76284 no way to tell based on that. Use python3 -m pip to be certain. Or use a virtualenv.
 
Alas
 
8:40 PM
Yes, or, use a virtualenv.
 
When I run "python3 -m pip install scipy" I get "Permission denied: '/Library/Python/3.8'".
 
perfect
It means it's the system python :P
 
But that has never happened before. Weird.
 
because you were using the wrong pip all the time
 
Seems like I somehow ended up with multiple pythons.
 
8:41 PM
your original error is guarantee for that
or at least multiple environments
 
My pip installs/imports worked before though. Have to figure out how to reset everything.
 
which pip3 and which python3 should show different paths
@user76284 use a virtualenv?
 
$ which pip3
/usr/local/bin/pip3
$ which python3
/usr/bin/python3
Hmm
 
@user76284 Buy a new laptop. It's easier :P
 
You could use python3 -m pip install --user ... but I recommend a virtualenv. Then everything is nice and isolated.
 
8:42 PM
I'd like to figure out why this is happening first though. In case another issue arises down the line.
 
But have you been using a virtualenv like Andras has suggested?
 
Not on this computer.
 
In which case, I suspect that a postmortem on how this happened is just going to be impossible
 
What do you think of conda vs virtualenv?
Overall.
 
In future, I suspect I won't be using Anaconda any more
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
 
8:48 PM
I see.
I'm going to try something. Brb.
 
Nov 14 at 16:47, by roganjosh
Don't bother. Just use pip. If it breaks, you can yell at me in another chat room
^ no yelling chamber was opened
 
Ha
 
 
1 hour later…
10:13 PM
1204
Q: What is the difference between venv, pyvenv, pyenv, virtualenv, virtualenvwrapper, pipenv, etc?

FlimmPython 3.3 includes in its standard library the new package venv. What does it do, and how does it differ from all the other packages that seem to match the regex (py)?(v|virtual|pip)?env?

Hmm
@AndrasDeak You said to use virtualenv but it looks like Python now officially recommends venv?
 
@user76284 yeah, I use the term "virtualenv" in general. Use the built-in venv module.
 
venv is different from pyenv, right?
 
they are separate items in the title of the question so hopefully the answers to that question answer this too
 
10:53 PM
Found this: “pyenv is a script shipped with Python 3 but deprecated in Python 3.6 as it had problems (not to mention the confusing name). In Python 3.6+, the exact equivalent is python3 -m venv.”
 
you removed the v from pyvenv in that quote :/
 

« first day (3701 days earlier)      last day (1230 days later) »