« first day (2891 days earlier)      last day (2067 days later) » 

 
3 hours later…
4:30 AM
Cabbage
How to render md or rst files to pdf?
 
 
3 hours later…
abc
7:31 AM
Trying to add some documentation with sphinx it seems but to complain when the type is not a default one dpaste.com/12GD04F Am i missing something?
 
8:25 AM
cbg
 
9:13 AM
cbg all
Just been looking at this nohello.com and it reminds me of the room rule here about just asking the question immediately
 
Did you just include that link in order to cover yourself from a single "cbg"? :P
 
Well the link is nohello.com not nocbg.com :P
Also I don't have any questions to ask anyone at the moment either unlike a couple weeks back when I had a bit of a cold and couldn't seem to figure anything out
 
Sounds more like man flu to me
 
user6718998
Hi there. Anyone familiar with Mandelbrot sets ?
 
user6718998
I am trying to plot one using matplotlib, but I am a bit stuck
 
I wouldn't say I'm familiar with them but what is the issue?
 
user6718998
My given formula is: Zn+1 = r*Zn*(1-Zn), Z0 = 0.4, where r is made of resolution x and resolution y
 
user6718998
which is quite different than a normal Mandelbrot equation with a c variable
 
user6718998
 
user6718998
this is how it looks for a normal mandelbrot
 
10:03 AM
Ok. What is your question though? What issue are you facing?
 
10:42 AM
Create an array of pixels, compute Mandelbrot, imshow/imsave
Fractals are typically raster images
 
@Thewise That's called the logistic map. I've never made images of it with complex args, but I've played with it using real numbers.
@roganjosh I don't know about that stuff, but I guess I can CV it as Too Broad
 
They probably wanted threading or something. But the outcome is to just spam someone with notifications. I doubt it's useful to anyone in its context other than people who want to cause trouble
It's not going to come up in searches other than people that want to spam
 
@roganjosh I guess he could do what he wants with threading, but I have ethical objections to assisting people who want to do stuff like that, even if it's just a learning exercise.
 
user6718998
@PM2Ring I think you are right. Though, the bitmap that I need to generate is pretty similar to Mandelbrot one. Any code I could see as example ?
 
I also don't know whether I should keep dumping close votes here or in the close chat room. Andras did ask me to post here, but I don't want half my posts to be close votes
I'm generalising Andras' advice, it was a discussion
 
11:09 AM
@roganjosh My 1st post to you was about the tensorflow / pytorch question. I'm obliviou about that stuff.
 
Well there isn't a question there
 
user6718998
 
user6718998
it needs to look like this
 
@roganjosh Well, the room policy is that we don't want to be a clone of SOCVR, but most ROs are ok with CV requests unless they turn into a flood.
 
I'm trying to find the balance :)
I reviewed my activity earlier and it was depressing. It's almost all close-votes on garbage, with a smattering of upvotes
 
11:15 AM
Even the most anti-cv-pls RO posts his fair share of them. :) But generally, it's best to only request votes on fresh questions, don't go trawling the archives looking for stuff to close. OTOH, if you happen to see stuff while dupe hunting that needs closing, feel free to mention it.
 
I never trawl archives to ask for CVs. What's done is done, I'm on the front-line :P I haven't asked for anything to be closed that's more than a day old, when I start running out of tabs
 
Also, on weekends, when the room is quiet, CV requests are less likely to be disruptive, but there are less people hete who can vote on them, and because traffic is lower the CV requests kinda stick out a bit more. But that's ok, IMHO.
 
Well, I was prompted to post more of them when I said too many questions were slipping through, so I'll continue as I am. But, if it becomes an annoyance then I'm happy to tone it down if told to. I'm trying to find the balance :)
 
@Thewise Sorry, I don't know matplotlib. IIRC, the last Mandelbrot program I wrote used Numpy, PIL, and Tkinter. Andras gave me some help optimizing the Numpy stuff.
 
11:22 AM
@Thewise I think the best starting point would be the code you're using currently. You showed me code for a standard plot, but you haven't shown your attempt at the new problem
 
Here's a really basic Numpy Mandelbrot. It's only black & white, with no zooming. stackoverflow.com/a/45378402/4014959
 
11:50 AM
Here's a JavaScript one I did a few years ago. It may not work fully on modern browsers, but you should be able to zoom in, even on a phone. forums.xkcd.com/…
 
@Aran-Fey I'm curious why you've put a bounty on this?
 
12:04 PM
It's a great Q&A, and I've used it as a dupe target many times. But it's already highly visible: for me, it's the top Google result for python valid input
 
Which is why I'm curious :) I just used it and spotted the bounty
 
I'm curious too. I'm sure Kevin won't mind the points, but it's not like his fighting for more rep. ;)
 
Canonicals should probably get royalties for being used :P
 
12:37 PM
Wrote a new SO answer after 3+ months... whew. Faced the problem myself, and existing solution on the question was (quite) a bit meh.
working Saturday cbg
 
cbg shad0w
 
@shad0w_wa1k3r With any luck, you'll get a necromancer badge for it. It only takes 5 upvotes, IIRC.
 
LOL, they've screwed profile views now
 
Also, one of them is also my highest voted answer :)
 
12:42 PM
Now it doesn't fit on screen, I have to scroll horizontally on chrome, and this is on a laptop
 
That answer also gave me the populist gold badge. Heavy answer!
@roganjosh doesn't happen for me
 
<sheepish> somehow I used ctrl and scroll wheel :/
 
hehe, happens :-p
 
I guess I got too enthusiastic clicking on screeen and hammering the keyboard :P
 
@shad0w_wa1k3r Nice work!
 
12:51 PM
@roganjosh re cv-pls: what PM said. My opinion is that if reasonable cv-plses become too much we can start dumping completed older ones to the knives
SOCVR has a userscript for that
 
@AndrasDeak but, as I said, I don't dig up old questions to close
 
I hate how on tbe old mobile view you can't see when someone was last active from their profile. That's fixed now on SO, but it's still a PITA on most other sites.
 
@PM2Ring That answer is a double-edge sword, it can do good, it can do bad. But well, at least I am not directly responsible :shrugs:
 
It's literally when I want to drop tabs of recent questions I'm following
@AndrasDeak we did have a discussion where you said I should link more of the questions I want closing
Or I've misinterpreted
 
@roganjosh Andras is saying you don't need to worry about it because we can just trash old completed cv requests if they get annoying.
 
12:55 PM
Ah ok
I don't wanna be thrown to the rotating knives though :P
 
At least it has a friendlier / nicer name now (after last to last room meeting)
 
Oh?
See, if yoyo guy was still around, I'd see the new name. I got bored scrolling cos it seems we've had a good period of nothing being kicked.
 
The room will show up on any of the mod's chat user profile - chat.stackoverflow.com/rooms/71097/…
 
@PM2Ring "last active" is garbage anyway. It was on meta last week.
 
@shad0w_wa1k3r s/mod/room owner/
 
1:05 PM
@shad0w_wa1k3r it's not renamed though?
 
@AndrasDeak I felt like something was wrong :-p
 
trash -> Ouroboros
 
@roganjosh yeah, that highlights page is not loading, so can't give a link, but it did happen :-p
 
since the penultimate meeting, actually
 
I'll take your word for it, with a skeptical glare :P
 
1:10 PM
in Python Ouroboros - The Rotating Knives, Feb 5 at 17:45, by Kevin
room topic changed to Python Ouroboros - The Rotating Knives: Messages from the Python room that didn't meet our standards of formatting, on-topicness, or civility. If your message was moved here, consult the rules and try revising to meet our criteria: http://sopython.com/chatroom (no tags)
 
It's an interesting transcript that you posted originally
 
I guess my previous link showed the name change better but I'm too lazy to repost
 
I've only had one bust-up over moderation, I think it's well-managed. I couldn't make the meeting but I guess the points would be made by others anyway
And, with that, I think I need a shower and go out and get a steak. I've done my watch closing trash on the main site. rbrb :)
 
Have a good one
@roganjosh if you have something specific in mind that wasn't raised you're welcome to add it to the next agenda
 
@AndrasDeak tbh I think it was raised in the heat of what was going on. If it was an issue, it would have been raised already.
 
1:25 PM
OK :)
 
@roganjosh True, but it's better than nothing. IIRC, I left a comment on that meta page.
FWIW, I was one of the ROs who agreed on the name Rotating Knives. I've always been a fan of the Architect Sketch
 
I'm not really fussed by the name tbh :) I just don't want to post stuff that ultimately has to be kicked into it. That's a waste of everyone's time
 
> This website is not accessible in the UAE.
wow
 
You're surprised?
 
yep, initially
 
1:36 PM
Ahh, specifically the Monty Python site
 
2:19 PM
unclear / too broad / no mcve stackoverflow.com/questions/52345330/…
 
^ he added some code, so at least the downvotes aren't necessary
bad formatting anyway...
 
2:34 PM
The downvotes pre-date the edit. It was downvoted when I commented on it IIRC
 
yep, was just mentioning since user is new and even if off-topic, it's not worthy of downvotes (after edit)
 
Someone should probably say "welcome" somewhere in the comments
 
@shad0w_wa1k3r Wonders will never cease. ;) I retracted my cv.
But yeah, it's still not perfect. I guess that's a nested function, but it's hard to tell.
 
he probably gave up after a while, seeing the -2. Competitive coders usually have little patience, but you never know :)
 
I didn't downvote but I am the close-voter
 
2:42 PM
there's an edit on it which is wrong, 1 more vote to reject.
 
... I would, if I had the option on my mobile :P
 
haha, I'm glad I only browse SO on laptop.
 
Got a screenshot this time
When I get home, what tags would that come under on Meta? I find it a confusing place. It seems like a bug to me
If there's a pending edit on a question, the edit button just disappears in my mobile view using Chrome
 
@roganjosh tag: bug
or you meant something else?
 
Just bug?
 
2:48 PM
maybe "design" too
or responsive-design
 
Bug and design it is :)
 
@shad0w_wa1k3r Rejected. Yam, I hate the mobile view of the edit review page. The desktop view is so tiny on a phone that it's almost unreadable, but at least it's usable if you have the patience to zoom in & out a zillion times...
 
SO really needs to hire some more frontend people, or even mobile app people...
 
There's a lot more action here meta.stackoverflow.com/questions/374024/…
@shad0w_wa1k3r Or pay attention to the experts over on SE UX...
 
^^ yeah, I remember that being linked, but didn't immediately find it on the meta Qs
rbrb, haven't played Dota in a long while, need to go get my yam kicked :D
 
2:55 PM
I'm becoming more frustrated with it recently. All my activity seems to be close votes or answers that can be placed in comments. Meanwhile, the UI changes are rampant and intrusive. I'm losing motivation.
 
I can relate to that. I get some enjoyment encouraging newbie answerers to improve their answers. Sometimes they take my suggestions onboard, sometimes they ignore me, and sometimes they self-delete.
 
user6718998
3:18 PM
@PM2Ring I am really not good at this... I mean, I know Python but algorithms are killing me. I don't know how to start doing it..
 
You start by writing some code and ****ing up. There is no other way to learn. Where are you at now?
 
user6718998
 
user6718998
found this code, worked around, but I don't understand it
 
user6718998
Thing is, that my teacher did not explain what a logistic map is or what should my algorithm do
 
user6718998
its bamboozling
 
3:33 PM
Well, take it step-by-step. What's the first, specific, thing confusing you?
You could treat it like a jigsaw. Let's try clarify the pieces
 
user6718998
I just know that it has to be a bitmap, where you enter 6 coordinates, mins, normals and maxs, then the Rx and Ry (resolutions) and take the height between the minimum and maximum coordinates and use two fors to iterate, then while you iterate value has to be between 0 and 255 because grayscale and none of this makes sense
 
@Thewise The usual way to make a nice image from it is to make a bifurcation diagram
 
user6718998
he said final result should look like the above diagram, which doesn't make sense if its logistic map
 
user6718998
the screenshot I posted earlier
 
But you're still being overwhelmed by the overall task rather than breaking it down
 
3:37 PM
For each r, start with any x value in the range, eg x=0, iterate the formula a couple of dozen times without plotting anything so it starts converging, and then iterate some more, plotting the results.
 
user6718998
@roganjosh Indeed..
 
user6718998
@PM2Ring could you elaborate a bit more ?
 
user6718998
Im very confused
 
So the first thing to do is drop the concern that it must be plotted
You can worry about that once you get something that actually works
 
Yowsers... the answer on stackoverflow.com/questions/52346241/… takes a bit of grokking.... wonder what's stopping insert from working more intuitively to start with...
 
3:53 PM
@JonClements because numpy arrays shouldn't change dimensions iteratively?
 
Well... there's nothing stopping you doing it it appears if you structure the arguments a certain way....
 
But it's horribly inefficient
 
@Thewise Ok, I didn't see that earlier. I've never seen that particular fractal before, but it's obviously similar to the usual Mandelbrot set images. And I can easily believe that it's a complex number version of the logistic map.
 
The whole array needs copying on an insert IIUC
Which is why I suggested they use lists. It's better to perform those operations on lists and convert to an array at the end
 
Inserting into a list requires copying or rebuilding the entire list as well... so...?
 
3:58 PM
I''m guessing that you use the r parameter of the logistic map formula in place of the c that you use in the standard Mandelbrot formula, z = z*z + c, with z & c complex, of course. So instead of mapping pixel coords to c, you map them to r.
 
It doesn't require a new block of contiguous memory?
Test it with %timeit. Reasonably confident that list alterations beat numpy inserts
 
@roganjosh depends... there's generally reserved space which can be used but stuff still has to be copied in memory (although shifting a few pointers isn't exactly slow...) but if it exceeds a threshold they'll be a copy...
 
@Thewise well you need an algorithm to implement!
Mandelbrot has a recipe too: apply recursion, see whether starting from pixel converges (or something)
 
@JonClements ugh, you're pushing me to test now :P What conditions would you like?
List size and insert position
I'm on a laptop so 50 billion is not a reasonable response btw :P
 
Errr... float('inf') ?
 
4:05 PM
Knew it was coming, beat you to it
 
nah... I saw the 50 billion and thought you were aiming too small...
Well it depends... CPython's list_object code has how it allocates stuff and behaves in that regard... so you'd need to find some test points that do/don't trigger reallocation etc...
 
That's your job
I'm still pretty confident that lists will beat arrays in this regard, which is why I put the ball in your court
 
I'm not that fussed... you're the one that's gone all "MUST DO TESTS!!!" I don't want to think this much on an early Saturday evening ;)
 
Too interested chasing the tennis ball :P Typical pup
 
@JonClements True, but a list always has spare space at the end so appends and small insertions are cheap. A numpy array is a classic array of data, not pointers, with no spare space, so any size changes mean the whole array must be copied.
 
4:10 PM
There's a ball? Where's the ball... someone said ball? /me runs around excited...
@PM2Ring it depends on how that's implemented.... list.insert can only do so at one position and does so inplace... at least numpy.insert has a chance at going... ahh... I've got to copy this array + 3 extra and then do it focused on that...
 
@JonClements a numpy array doesn't have to make a decision, it copies the lot every time
 
So I imagine for numpy it wouldn't be difficult to allocate an N array, copy from 0 - 100 frmo the original, then 1 from the insertion, then another 500 from then original, then last 2 from the insertion, then just the remainder of the original etc...
 
Jon's point is that Numpy has the luxury of copying to a new array, list has to do it in-place.
 
So my guess is for single insertions - a list will most likely be faster, but with a bulk amount of insertions, numpy stands a better chance of doing it efficiently when allocating/copying to the new array.
 
Sure, but if you're doing insertions into a Numpy array inside a for loop, you're doing an awful lot of copying. OTOH, doing anything in for loops with Numpy is generally a bad sign.
 
4:17 PM
np.insert alone makes me frown
As in "I've got a bad feeling about this"
 
I eat my hat
import numpy as np

a = list(range(100000))
b = np.array(a)

def list_insert(lst):
    return lst.insert(500, 0)

def np_insert(arr):
    return np.insert(arr, 500, 0)
%timeit list_insert(a)
129 µs ± 20.2 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)

%timeit np_insert(b)
74.9 µs ± 199 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
Or I've cocked up in my tests
 
Well... you're increasing the size of lst 10000 times there...
 
So in-place modification?
I'll have to subtract it out
 
Yeah... that inplace stuff we've been mentioning :)
You can check though with len(a), len(b)... :)
 
Same applies to the numpy array though?
 
4:28 PM
nope
 
import numpy as np

def list_insert():
    a = list(range(100000))
    b = np.array(a)
    return a.insert(500, 0)

def np_insert():
    a = list(range(100000))
    b = np.array(a)
    return np.insert(b, 500, 0)

def setup():
    a = list(range(100000))
    b = np.array(a)
%timeit list_insert()
12.3 ms ± 79.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)

%timeit np_insert()
12.6 ms ± 337 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit setup
41.3 ns ± 0.121 ns per loop (mean ± std. dev. of 7 runs, 10000000 loops each)
Ah poop, my last benchmark is nonsense, I didn't call the function
%timeit setup()
12.4 ms ± 327 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
And now that makes some horrible reading. The insert looks insignificant compared to instantiating the lists/arrays. Something has gone wonky. Maybe I'll join the Saturday club and say that I'm no good at benchmarking today :)
 
4:47 PM
No, that makes sense. A single insert shouldn't be that costly
 
5:03 PM
@AndrasDeakon the ms scale I really would have expected some time
 
3
Q: Pandas: how to convert a cell with multiple values to multiple rows?

UserYmYI have a DataFrame like this: Name asn count Org1 asn1,asn2 1 org2 asn3 2 org3 asn4,asn5 5 I would like to convert my DataFrame to look like this: Name asn count Org1 asn1 1 Org1 asn2 1 org2 asn3 2 org3 asn4 5 Org3 asn5 5 I know used the following code to do it with two columns, but...

How to split two columns with multiple values? for example, I have two columns like "ASN" and "ASN2" like the one stated in the above question?
 
What's your current code and how is it failing?
 
df2 = df.asn.str.split(',').apply(pd.Series)
df2.index = df.set_index(['Name', 'count']).index
df2.stack().reset_index(['Name', 'count'])
 
Well that's just the code from the post you linked
No code in SO answers is going to be ready-made for your specific problem. How have you tried to adapt it to your problem?
 
df3 = df.asn2.str.split(',').apply(pd.Series)
df2.append(df3)
 
5:28 PM
Grrr... sure we've got plenty of dupes for stackoverflow.com/questions/52347116/… - I know I've written answers showing it using reduce/for-loop but can I find any of 'em!?
 
@JonClements I've lost my patience with them :/
You've (or someone) cleaned it up. Was I flagged?
I think that's enough SO for today :)
rbrb for a bit
 
CaBbAgE :D
 
Cbg, Null
 
@JonClements Anything useful here, or in my linked answers? stackoverflow.com/a/41778581/4014959
 
@roganjosh No flags that I noticed... just tidied up a bit while there...
 
5:37 PM
@JonClements That's fair enough. I've had my dose of SO madness today, it's a cue to leave the house :)
 
@PM2Ring I think this is more focused purely on nested dictionaries... so I was thinking along the lines of this answer
@roganjosh fair enough... won't happen to be passing by Gregg's would you? /me does puppy dog eyes...
 
There's 3 houses between me and the local pub. Greggs is a trek. I think you'll have to go without mate, sorry :/
 
sighs... I suppose just bringing back a pint will be fine :)
 
I'm on a tab. Find yourself in Manchester, you have a pint waiting
 
/me makes a note to hold you to that :p
 
5:42 PM
Easier than a pastie, at least it can stay in the pump indefinitely :)
 
@JonClements Fair enough. I did a dict-only version in the last month or so, but I can't remember the context, so trying to find it on the phone would be a bit hit & miss. I guess the one you linked is passable, if the new OP reads all the comments. ;)
 
They don't appear easily pleased :)
 
6:04 PM
Indeed. It's like they've got an idea of how it should be done, and are stubbornly sticking to it, despite the facts. Oh well.
 
6:36 PM
i have forgotten why i wanted numpy. i wanted to program tic tac toe and it was for initializing a board. i have now numpy.
 
An interesting reason to install numpy :)
 
@Alucard store the board as a 2d array
Either of single-char strings or ints
 
6:53 PM
@DSM ha... knew there was a nicer way to do that "mean" question :)
 
7:04 PM
recbg
 
7:25 PM
Cabbage @AnttiHaapala If you think datetime is a mess, you ain't seen nuthin'. Take a look at the insane history of UTC, summarised by astronomer Steve Allen of the Lick Observatory. Be warned, even the summary is rather large... ucolick.org/~sla/leapsecs/timescales.html He briefly discusses some of the key issues here ucolick.org/~sla/leapsecs
FWIW, I found those articles on the delightful leapsecond.com site.
 
7:49 PM
@roganjosh Pretty much what PM2 said. Now that I've hit 20k and have no further use for my rep, I'm planning to give it all away to answers that deserve it
Hopefully people will realize that everybody can write a great answer, without having to be an expert in any specific technology
I know Kevin doesn't need the internet points, giving him more of those isn't my primary objective :^)
 
Sam
Evening all.. quick Q regarding web development.. I've made an authentication module using Python Flask with an ORM sqlite wrapper.. Why/when would you build your web modules as an API?
 
DSM
Everyone's favourite Flask maintainer was interviewed on Talk Python! (See Martijn's earlier one).
13
 
Sam
Sweet. I'll have a listen
 
Does anyone know what the three last digit and the "Z" represents?
"2018-09-15T17:46:49.613Z"
Could it be miliseconds? But then what is the Z for?
 
8:06 PM
@SebastianNielsen You should read the wikipedia page about iso formatted dates/times
> If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset.
 
I need some help from the meta-dwellers here. I posted this question asking how to deal with a bad canonical, and while the votes are clearly in favor of the "delete it" answer, the question is not only not deleted yet, but not even closed (it was closed and then reopened and now no more close votes are piling up). So clearly people disagree with the "delete it" solution, but can't be bothered to write a meta answer explaining their reasoning.
So I'm not sure what to do. Do I accept the highest-voted answer and post a cv-pls followed by a delv-pls here?
Why doesn't meta have a bounty system yet, by the way? I need a "canonical answer required" bounty
 
8:28 PM
No rep, no bounty
Otherwise I don't know
 
I guess I'll stop using meta. I can count the number of questions that didn't turn out to be waste of time on half a finger
 
Ask better questions :>
 
Ironically, I spent the last 5 minutes reading a SO hate thread on reddit, and "y'all haters need to ask better questions" is exactly what I was thinking the whole time
 
8:50 PM
Cases where meta gives a clear-cut answer usually mean you can know the answer without asking
When you ask you'll only get opinions
 
I wouldn't mind if the people who oppose closure/deletion would speak up and explain why, but a half-hearted "y'know, sometimes these kinds of questions make sense" is apparently the best they could do
 
9:16 PM
So your answer is "it is a case-by-case basis"
 
 
2 hours later…
11:12 PM
I registrated for "Functional Programming" what happens if it starts? does it open a new tab or what?
 
@Alucard your question is unclear
 
oh i mean i registrated for an event here on stack exchange see chat.stackoverflow.com/rooms/info/110313/…
 
11:37 PM
@Alucard you'll get a notification reminding you. That's it.
If you want to chat you need to go there yourself
 
ah ok :)
 

« first day (2891 days earlier)      last day (2067 days later) »