« first day (3167 days earlier)      last day (2005 days later) » 
00:00 - 18:0018:00 - 00:00

18:00
@cs95 No, with the 11 years of pandas cruft the place to start is identifying canonicals for basic but very important stuff (like the ones I mentioned). Then b) we discuss here and agree which are canonical, which meed improving, which are too (pandas-)version-sensitive, which need better MCVE etc. Then c) we dupe-hammer all duplicates into them. d) Janitorial on bad/new/low-traffic questions comes last, if at all. At least, that's how I intend to spend my very limited time and energy.
At this point once I fix this one bit it should all work so that all the other code just runs those functions without needing actual SQLite. Honestly I just want it to run one basic level to prove to myself that I could add more content if I wanted to. (and then probably never touch it again)
@piRSquared I guess that's a brand new badge.
I just scored a pair of them.
ah nvm it's already been brought to attention
hmm print(f"{'\r'}") -> SyntaxError: f-string expression part cannot include a backslash while this is ok print(f"\r")
oh, expression part!
I don't understand why not... but at least I understand the error message now.
18:07
@cs95 thank goodness that SO is standing up against the unwelcoming that's spreading in our universe. Now even the badges are being affected! I hope soon they will remove downvotes as an obvious agent of Unwelcomingness
cbg, what's a good Python library that can plot me a relief map, such as flightsfrom.com/uploads/articles/… from flightsfrom.com/map ?
for map stuff I'm only aware of matplotlib's basemap and cartopy
well, getting the map x,y,z coordinates is cheating
> If the Tumbleweed badge is successful as a consolation prize, we’d see people who get it asking more questions on the whole.
citation needed
fortunately in the world of "data science" any claim you make up is a scientific axiom :P
@AndrasDeak something tells me you will never get a free lifejacket. :(
18:13
I won't get any new ones for sure, but I did get one retroactively
I got a tumbleweed early days and I kept on asking.
I got tumbleweed recently on Crossvalidated. Probably didn't help that I asked at like 8 PM EST
well you will never be abused by that filthy badge ever again
while I'm all for free badges I just hope people don't start fgitwing low quality questions in the hope that their answer magically reverses the innate crappyness of the question
TBH we should really be rewarding badges for closing things, not answering them
(eh, there's abuse there too, but I'd rather people abused that than this)
Pandas Golf: Create this dataframe:
   Q   R   S   T   U   V   W   X   Y   Z
A  0   1   2   3   4   5   6   7   8   9
B  1   2   3   4   5   6   7   8   9  10
C  2   3   4   5   6   7   8   9  10  11
D  3   4   5   6   7   8   9  10  11  12
E  4   5   6   7   8   9  10  11  12  13
F  5   6   7   8   9  10  11  12  13  14
G  6   7   8   9  10  11  12  13  14  15
H  7   8   9  10  11  12  13  14  15  16
I  8   9  10  11  12  13  14  15  16  17
J  9  10  11  12  13  14  15  16  17  18
You can assume Numpy and Pandas are imported
import pandas as pd
import numpy as np
No points for the absence of pep8 whitespace
mind the columns
ah, didn't see that
hmm
there's probably a better solution for the columns, but spoiler
pretty good
but I'm building off of yours pastebin.com/wScBaJee
Your Numpy bit was clever. I'll remember that (-:
wim
wim
what the heck, I just got a badge and a boatload of badges
there a meta about these?
scroll up
18:38
The offensive rule of evil badges is over
Long live the helpdesk
Instead of (just) reputation and badges, I want a cut of add revenue attached to my posts.
@piRSquared that's definitely more succinct
/shrug just bored while my work code runs
I'd hoped the lifejacket badge I just got was for a question that I turned around by shining my own particular light on it. The kind of question that looks ambiguous at first glance, but after looking at my answer, you would think "when you put it like that, there's only one objective solution, and this is it".
@piRSquared add it where exactly? :P
18:41
But no -- it was for a pretty basic question that just happened to accumulate a lot of SEO juice over the years.
Good old RTFM always pays out in the long run
There is a Numpy function that does this but I can't find it stackoverflow.com/q/56655168/2336654
wim
wim
for-loop over numpy array.. tempted to downvote you..
It's a list first of all... second, that's fine I'm still looking for the proper Numpy call
wim
wim
It's 100% clear from the question the O.P. knows how to do with for-loop and is looking for the numpy way, so I don't think suggesting a list comp is adding any value here
18:47
this seems like a nice XY problem
Like I said, that's fine. Its a place holder while I look and then I'll delete if I don't find it.
wim
wim
Don't add place-holder answers.
Even that Numpy answer that popped up is not it. Yam, this is going to bother me
why it has to be a 1-liner? lol
It wasn't meant to be. I stalled out while trying to answer.
wim
wim
18:51
yeah, I don't know the numpy trick off the top of my head. but for sure one exists.
maybe can use np.meshgrid or something
[[i, j, v] for (i, j), v in np.ndenumerate(arr)]
wim
wim
the np.indices answer looks good enough for me
i don't think a straightforward trick exists. I asked the exact same question a while back and Divakar produced a fairly involved answer
I guess the trick you were looking for was one with ogrid
Can anyone remember offhand why Guido didn't give Python multiline comments? (Apart from unassigned triple quoted strings that aren't docstrings). I vaguely remember reading some rationale for it, maybe in the old Python FAQ. But I just tried searching & had no luck, just a zillion suggestions to use triple quotes.
wim
wim
ok divakar tried the grid thing already
ugh, for some reason I hate seeing users IPython prompts in questions/answers
its such an ugly prompt
18:59
IMO prompts (python or ipython) are OK when you're demoing a function. It's visual proof that you ran something and it worked. Personally I don't like including them in my answers anymore but they are tedious to remove if you want to include the output as well. Otherwise %history is useful
I want a prompt whose contents I can paste into my own prompt, without removing any characters, and it executes identically to the original code.
example:
;;;print("Hello!")
###Hello!
Ok bad example because I thought you could put superfluous semicolons at the beginning of a statement and Python would ignore them.
1; is a legal Python program so why isn't ;1
np.ndenumerate is what I was thinking of... but now I think it's gross @wim @cs95
I really like Divakar's answer btw
@Kevin 1;; isn't a legal program, though, so presumably something must precede each ;
None;print("Hello!")
#####Hello!
@Kevin In Python, semicolon is an optional statement terminator, not a statement separator.
...;print('hi')
19:12
Huh, semicolon on python prompt throws a SyntaxError but on ipython doesn't
In [90]: ;
Out[90]: ''
>>> ;
  File "<stdin>", line 1
    ;
    ^
SyntaxError: invalid syntax
Ideally the prompt text would be an expression evaluating to None so it doesn't get displayed by the REPL I paste it into
Start every program with an invisible ___ = None so I can do ___;print("Hola")
@cs95 Similar to my question that wim mentioned here
Not sure if it's related to what you see, but it was in answer to what I found here
interesting
Hmm, just remembered a conversation where I was critical of Altered Carbon and the other participant was insistent that I was way off-base and it now occurs to me that the show I was thinking of was Black Mirror and not Altered Carbon. That explains things.
Has anyone used ZeroRPC before? What was your experience with it?
wim
wim
19:19
@PM2Ring that (triple quotes) is Guido's reason though. they don't generate code.
If Python had proper comments my hyptothetical prompt could be /***/print("Bonjour")
wim
wim
@cs95 I use IPython but with the classic prompts. All of the covenience, none of the ugly.
lol. proper comments
True authentic salt of the earth comments
free range gmo free
wim
wim
@Yamaneko bad
their claim of "First Class Exceptions", which is what made me try it in the first place, turned out to be false advertising
19:23
@Kevin ipython does that
@wim Is there any better alternatives? We're struggling with it, it looks rather slow.
I am led to believe that I can paste the contents of an ipython session into an ipython session and it will work. That's a good start, but I want to be able to paste the session into any repl.
wim
wim
@Yamaneko I looked for good alternatives but did not find.
Thanks, @wim, that's another thing I didn't know I needed in my life
wim
wim
I went with python-rq for transport in the end, and decided I didn't need the RPC-like features so re-engineered around those requirements.
19:25
You can paste native repl into ipython. Close enough.
@wim True, but he didn't exactly promote triple-quoted strings as comments in the early days. But he did mention it in a Tweet from 2011.
Cant do anything about the Out[..] prompts, I assume
wim
wim
@Yamaneko some related stuff in fabric 2.x and invoke looks promising but is all a bit green still and in need of some attention
I get the feeling that this guy may have problems getting into the American space program...
wim
wim
create a file like ~/.ipython/profile_default/startup/00-config.py
19:29
@wim Thank you! I'll keep an eye on that.
wim
wim
then put in it some stuff like this
import sys, warnings
from IPython.terminal.prompts import ClassicPrompts


if __name__ == "__main__":

    print('🐍 ' + '.'*sys.version_info.major)

    ip = get_ipython()
    ip.colors = 'neutral'
    ip.highlighting_style = 'perldoc'
    ip.prompts = ClassicPrompts(ip)
    ip.separate_in = ''
    ip.confirm_exit = False
    ip.refresh_style()

    warnings.simplefilter('always')
@wim We were considering replacing it by something like Redis. python-rq seems more the way to go
wim
wim
I've got a whole bunch of other crap in there but I guess that's the important stuff for the classic prompts
wim
wim
@Yamaneko you still need redis. rq just uses that redis as a queue, and gives a nice high-level python interface to the queues.
19:33
@wim I was aware of the startup script but that code snip is exactly what I needed. Thanks a billion
wim
wim
teh semicolon thing seems to be a variant of this bug github.com/ipython/ipython/issues/9698
att
att
I'm looking to use python-jira library and move status filtered by components name, so far the code I worked on :issues_in_proj = jira.search_issues('project=name')
component = jira.project_components('name') for issue in issues_in_proj: print(issue.fields.components("id" : "441"))
if ("Progress" in issue.fields.status.name and "441" in issue.fields.components(id)):
wim
wim
the normal usage is supposed to be like this, with a callable after the semicolon:
>>> ,list 123
['1', '2', '3']
>>> ,list 12 3
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-32-4d3565665fcf> in <module>
----> 1 list("12", "3")

TypeError: list expected at most 1 arguments, got 2
>>> ;list 12 3
['1', '2', ' ', '3']
i.e. it's like the ,autocall but when you don't want to split input fields on space
omitting the function seems to be like using an identify (lambda x: x) as a default function, but I don't know if that's just a quirk of the implementation or actually intentional
>>> , xyz a
('xyz', 'a')
>>> ; xyz a
'xyz a'
......I know way too much about this stupid feature.
What is the purpose of autocall? This is at least the second time that there's unusual behaviour, and this being the intended use just looks buggy
callable 'hello' --> callable('hello'). Why would we want this?
wim
wim
good question
19:44
@JonClements What would be required to help? I'm happy to help out the PSF!
wim
wim
I can only offer a guess - IPython was originally developed by scientists(?)
Scientists often aren't the best coders, and may have weird / non-sensible desires for the UI.
There's nothing inherently wrong with a language that doesn't use parentheses to call a callable, but there's something wrong with trying to make Python into that kind of language.
Save yourself some effort and just download Lisp
I can honestly say that I have never (at least knowingly) seen it being used anywhere. I hadn't even heard of it until you mentioned it when I got some weird output. It just seems to silently lie in wait to cause confusion :/
wim
wim
github.com/ipython/ipython/issues/9698#issuecomment-230368137 <-- "save every last keystroke" mentality
@roganjosh I don't know the context, but my suggestion would be that it might emulate another syntax that users were more comfortable with? Whether that's arguments to DOS or bash terminals, or the 2.x print function?
19:46
(I don't actually know enough about Lisp to be sure it has paren-free callable calling. Insert your own language of choice that fits better)
[and providing older/less techy users with a more familiar API is something I've considered when writing helper scripts for my wife.]
<insert knowledgable comment from abarnert about some obscure feature of ten different obscure languages here>
wim
wim
I just don't like the idea that everything I type into IPython repl goes through some horrific regex based pre-processor
@cs95 hmm? Is that not also part of --classic?
wim
wim
try ,1 and you can see directly in the traceback that it gets converted to 1("") before eval and I can pretty much guarantee you they will have done this kind of crap with regex
19:49
Can functools.reduce be used for applying a function on the same object with different arguments, example is there a functools.reduce variant of say 'aacc'.replace('a','b').replace('c','d')
@AndrasDeak I was trying something else. Wim's code fixed that too
OK, I couldn't figure it out looking at the transcript
@wim I can attest that this is 100% absolutely pure truth
goes to show one mustn't cargo cult random stuff from random places
@roganjosh MATLAB
not a good reason, but a reason nonetheless
I wonder what the influx from MATLAB to Python is these days
In terms of people turning their back and trying Python for the first time
I'd imagine a lot better than python -> matlab (lel)
I can imagine when it was breaking into the whole Data Science arena, an awful lot would have been trying to do the switch. I would have thought, now, that the distinction and benefits of either would be better established
Apr 30 at 19:49, by Kevin
quit() is the most useless builtin because you can't quit the Python life
19:57
I can live with the quirks, anyway. It's just interesting to still be bumping into them after several years I guess.
@DeveshKumarSingh Without lambda? I don't think so. Unlike map, reduce doesn't accept callables with an arbitrary number of arguments. With lambdas? Wrap the callable in a two argument lambda and unpack the second arg:
>>> functools.reduce(lambda s, args: s.replace(*args), [("a", "b"), ("c", "d")], "aacc")
'bbdd'
For the exact problem of replacing single characters with other single characters, you might be better off with maketrans: "aacc".translate(str.maketrans("ac", "bd"))
@DeveshKumarSingh that's more like mapping the arguments onto the method, not reducing the elements
stackoverflow.com/q/56656215/4909087 close as either lacking mcve or no repro (see comment)
I bet fully-fledged functional languages have a way to do this in like five characters
[s := s.replace(a, b) for a, b in (('a', 'b'), ('c', 'd')]
that should work, I guess
or just write it as a loop...
20:15
Got it, actually there was a similar question where I did use a for loop
@MisterMiyagi Textbook harmful listcomp asspression, nice
But was wondering if there was a functools solution for it
@MisterMiyagi That’s upcoming in 3.8 :)
@AndrasDeak I am trying my best finding a good use for :=. so far no luck
It was a decent tribute to PEP 572
hi there
list(0. for i in range(5))
what is this 0. doing there?
20:21
its a float 0
or what is the whole line doing? didn't understand that
ahaa
ok thx
from 0.0, 0.1, 0.2 ... till 5 right?
[0.0, 0.0, 0.0, 0.0, 0.0]
walrus ops help make code concise by reducing at least 1 line of code, great. They also legitimize side effects, not so great. Is brevity at the cost of clarity really worth it? Well, Guido seemed to think so. Like it or not, it's here to stay.
no. just run it and see, the code is writing 0.0 5 times in the list
ahaa omg hehe
ok thank you!
yeah.. why I didn't just run it and saw what happens
20:23
why indeed
@Suisse It's an idiot way of writing [0.]*5
haha
[0.]*5 looks shorter and more readable
but gives me an error when I run [0.]*5
oh no
intend and so
wim
wim
Apr 17 at 20:52, by wim
assignment expressions: putting the "y tho" back in "python".
21:13
What I hate is about assignment expressions is that you're not allowed to write it the old way... they force you to use the new syntax even if you don't like it.
I think this idea comes from C where people often try to convert int * 1.0 to float
@piRSquared You mean you'd prefer x = (y = 3)?
@anonymous huh?
@AndrasDeak ? not sure what that means. But I was being coy. I wanted someone to say "But, they don't force you to do it that way. It's available if you want it. But no one is forcing you." And I would respond "You don't say?"
But, they don't force you to do it that way. It's available if you want it. But no one is forcing you.
You don't say?
/giggles_inside_for_at_least_15_seconds
21:23
I think the script could do with some revision. That was beyond a dramatic pause, the director was making circular motions with his hand and mouthing the words
thanks. that helped.
 
1 hour later…
22:33
cbg
umm... seems to be a huge divide on the whole "walrus" operator thingy
I don't mind it... but only in the same sense that I don't mind f-strings...
Something like: f'{x}_{y}_{z + 1}' is fine (imho)
However, when you're reviewing code and it's f'{somefunc(x).lower()}_{hex(int(y))}_{z}' or something... it's just horrible...
Might as well just do:
'{x}_{y}_{z}'.format(
    x = somefunc(x).lower(),
    y = hex(int(y)),
    z = z + 1
)
at that stage...
But f-strings are very useful in very many cases, and it takes effort to write bad code with them. Just like list comprehensions. But with asspressions it's very easy to write bad code for the benefit of very few actual good use cases.
even the PEP has horrible examples
the regex one for example makes sense... for cases like that - I'm thumbs up...
yes, those are one of the very few situations where I don't hate it with a vengeance
just before that example:
stuff = [[y := f(x), x/y] for x in range(5)]
and my favourite, because listcomps with side-effects and leaking variables are the best:
# Compute partial sums in a list comprehension
total = 0
partial_sums = [total := total + v for v in values]
print("Total:", total)
wim
wim
22:45
the regex one doesn't make sense to me. just put the match on a separate line, what's the problem.
I can certainly understand the appeal of while line := fp.readline(): but that just doesn't cut it to add new syntax
I guess then, people who want to (ab)use it can and those who don't - just won't... don't see what the fuss is about :)
wim
wim
the partial sum thing would just be better added a function called accumulate in itertools or functools or whatever dumping ground. no need for new syntax.
@wim well, there's an itertools.accumulate...
22:48
Jul 10 '18 at 13:52, by Andras Deak
@idjaw as I see it it's good as long as reasonable people use it responsibly, which means it's bad
New syntax you should almost never use but you can very often use is bad.
then just don't use it :)
wim
wim
so, uhh, is that example actually the same as list(itertools.accumulate(values))? just a different way to do the same thing?
@JonClements Indeed I have the luxury of only maintaining code that I myself have written. This is not typical, as I understand.
@wim but teh total!
wim
wim
isn't the total sitting in result[-1] ?
I for one can ignore asspressions and just downvote any answer on SO that uses them, but this doesn't magically make it not a concern for me.
@wim on another line? Surely you're joking, Mr. Wim.
22:52
well, you can vote how you want, but I'd like to think that you wouldn't downvote an otherwise reasonable answer just because you don't like asspressions :)
no, I would only downvote unreasonable asspression answers (good luck finding reasonable use cases)
also,
Jan 25 at 10:46, by Andras Deak
That's my intention. Use responsibly -> not fit for SO
:)
darn you and your ability to find chat messages so quickly... have you got 'em bookmarked somewhere?
I just searched my chat messages for "responsibly"
woohoo... thunder and lightning and lots of rain going on... nice...
wim
wim
Well the venn diagram for "reasonable answer" and "assignment expressions" is looking like a Lemniscate
22:56
@JonClements I wish I could say this was the first time I'm arguing this point :P
at least that wasn't particularly harmful
yup... was surprised to see some new silver badges when I logged in today... they kept that one a secret :)
they feared that Big Unwelcoming might sabotage the project if they learned about it
They have spies everywhere, you know. Even among the badges.
wim
wim
you are cynical man
22:59
I'm a concerned citizen :P
wim
wim
don't look at it like part of the welcoming thing, even if it is
I don't mind if it is part of the welcoming thing. I mind that it's dressed up as part of the welcoming thing.
wim
wim
ok. you can also look at it as incentivizing improving the salvagable questions which are poorly written but are somehow interesting underneath
I don't mind either of those badges going to the trash.
But "unwelcoming" is like the frowning face of Emmanuel Goldstein in 1984. It lurks in the shadows and threatens to kidnap our babies! It's in our posts, in our comments, now even in our badges! Hide your valuables because unwelcoming is at the door! <insert footage of universe falling apart in Neverending Story>
awww... Neverending Story - one of my favourite films ever...
23:02
Artax always breaks my heart :(
And it turns out they are sequels to the movie, I've never seen them. But it makes sense because the book has much more plot than the (first) movie.
oh - don't watch the sequels - they're complete sh?t
Ah, thanks for the heads-up. And that sucks :/
Oh Artax in the swamp of despair... and Artreyu yelling at him to not give and trying to pull him out by the reins while he sinks depeer?
Yeah :(
basically view spoiler
yeah... I still at my age when I watch it have to skip over that bit... 'cos it's so well done...
But heck, Falcor... gotta love him.... end of the movie scene and all that: youtube.com/watch?v=adBmLtE4wwg
23:07
Ah, Falcor. In Hungarian he's called Fuhur, apparently according to the German name.
> The original name Fuchur is derived from Japanese Fukuryū (福竜/福龍, "lucky dragon").[citation needed] It was changed in the English translation because the pronunciation of the original name is similar to that of the agentive form of an English expletive.
haha, this is great
I wouldn't call that lucky at all.
There's always something... I know one of the production team that comes up in credits for Star Trek: The Next Generation was "Mary Fukuto"... I can see that one going pear shaped...
wim
wim
haha, remind me of pacman
Pacman originally called Puckman but too easy to scratch off the right side of the "P" on arcade game cabinets
I wonder how long it took for them to realize that
23:16
some of the kids I know, probably about 5 seconds :)
@Andras what's really sad is, I actually have some "auryn" cufflinks somewhere
I had to google that.
Not that big a fan of the never ending story then :)
I take it you didn't mean the Spanish boy band, but rather the ouroboros on steroids
Jun 6 at 22:40, by Andras Deak
well, yeah, I liked it, but I wouldn't think to mention Michael Ende as a favourite
23:19
:P
Just doing a bit of data extraction/analysis for a client regarding primary schools and stuff
I find it amusing there's a primary school in the UK called "Dog Kennel"
sounds like fun :D
well, "Dog Kennel Hill School" to be exact, but why on earth would you name a school that? (Short of having a bizarre sense of humour)
Historical reasons perhaps? There was a huge dog pound there before the school, or it's right nextdoor?
as in sometimes you name things "Church Cottage" etc...
possibly, but you'd have thought the school's governor's would have put forward something to change the name anyway...
Dog Kennel Hill Adventure Playground is also there, I suspect the hill is named such
Or/also the road is named Dog Kennel Hill?
23:27
yeah... haven't looked fully at the data accumulating - it's just one that popped up that made me chuckle...
I can see why, imagine all the puppy friends there!
it's likely to be one of those things where it's just "someone decided to name the place what...!?" things...
On a side note, I was chatting with a mate tonight about "famous" addresses or aliases for 'em...
@Andras if I said "The Whitehouse" - you'd know/infer what I was referring to, I guess?
and if I said "Number 10" ?
23:33
that's interesting...
named numbers only go up until 2 in my book
google it and see the first result :)
"N Downing Street" would click for me, regardless of the value of N
ahh... so "Downing Street" just by itself would have been enough?
23:38
okay interesting, thanks
no worries
and if I'd have said Pennsylvania Avenue - would you have immediately got that?
nope, also non-immediately :P
Then again I'm quite ignorant in the ways of both foreign countries and geography.
no worries :)
Without searching for it, what's the capital of the US?
Washington, DC
23:48
and the capital of Florida?
States have capitals? :D
Let me think if I can name any city
most people go for Miami (or Orlando)...
(I probably only know this one because of pub quiz stuff)
Is Tampa a thing?
23:51
yup, Tampa's in Florida :)
Yay :D
but it's not the capital :)
No idea
it's Tallahassee
23:53
(think I spelt that right... lots of repeating l's , s's and e's in it)
Sounds half Finnish
last one then, and without googling/such, the capital of Australia often comes up in a quiz, what's your guess on that one?
Not Sydney. Not Perth. Uuuuh
I know this
and it's not Melbourne either if you were going to say that :)
23:56
(most people go for Sydney - which actually makes a lot more sense then the one it is)
I give up, I could probably name this one if it were less 2 AM
Canberra :)
Ah, then no. Never would've guessed that.
I wouldn't have even been sure that it's in Oz
Never been there myself, but apparently so.
00:00 - 18:0018:00 - 00:00

« first day (3167 days earlier)      last day (2005 days later) »