« first day (3356 days earlier)      last day (1608 days later) » 

12:02 AM
I've just been totally shocked at how bad I am at matplotlib. I've not used it for the last few years beyond debugging and just dumping x, y data that only I need to understand to graphs. As much as it pains me to say it; JavaScript plotting actually makes more sense to me :/
 
matplotlib isn't great, agreed
they do have an old api and a new api, are you using the newer one?
they just ported over the matlab plotting interface more or less verbatim. So that's why it's so stateful and everything.
 
I'm not actually sure. I have V 3.1.0; was there a distinct change?
I find the docs... disparate, compared to other libraries but that might explain it
 
Ah, right, I see. So the older API is called "pylab" and it was even more state-machine based than the current one (pyplot), which has a state-machine per object. Whereas pylab had a global state machine.
but yeah, it's still similar to matlab, so that's why they have the weird state-machine thing in the first place.
 
But, now I think about it, I seem to remember having issues doing from 1.x to 2.x, so I've only just realised we're on 3.x.
@Azsgy Funny how it disappears from mind. I used to be doing geofencing in basemap and a couple of years on, I forget how everything fits together. It does seem a bit alien :)
 
Sam
12:31 AM
Hi there. I'm still working on speeding up my code (massively) using expressions, but I'm still getting used to slices. I have a 2D (numpy) array of data called "omega" and a list of indices I need to visit called "u_neg_ind". I also need to iterate "omega" one point to the right of the indices in "u_neg_ind" (i.e. u[i + 1, j] ). Dumb question, but how do I add 1 to all of the x coordinates in the u_neg_ind array? Thanks!
 
@Sam Hello. Something like np.roll?
Or just offset two arrays with one starting [:-1] and the other [1:] (for 1D). We could do with a MCVE
 
Sam
@roganjosh Hi @roganjosh. Thanks for the quick reply. I don't think np.roll works for this situation, since "u_neg_ind" is essentially just a list of points (x, y) in the omega array that I need to visit, and I also need to visit all of the points (x + 1, y). Does that make any sense?
 
Not for me, but maybe for others. I take "visit" as meaning from_name and to_node, in which case, the offset will work if you're using it to reference a matrix
 
Sam
12:46 AM
@roganjosh Ohhhhh.... Are you saying I roll omega[u_neg_ind] ?
 
Roll, or shift, the index to align the origin and destinations that can be used as an index for something else. but I still don't really know what we're talking about because there is no MCVE
 
Sam
1:10 AM
@roganjosh Sorry for the delay (it took a while to figure out how to code a MCVE): pastebin.com/fnH8DHTX
 
@Sam No worries for the delay, it's worth it for an MCVE, but I've literally just got in bed an set my alarm (past 1am here sorry!). Thanks for responding to the feedback, hopefully someone else will pick it up for you
 
Sam
1:58 AM
@roganjosh Not a problem. Creating the MCVE gave me a good space to play with the problem, and I was able to get a solution that should be good enough (unless someone here flags it as a problem): indices[:][1][:] += 1 . Thanks again for the help!
 
 
5 hours later…
 
1 hour later…
7:42 AM
Anyone working on OpenCV or worked with it? Need urgent help!!
 
8:02 AM
If you have a specific question in mind, go ahead and ask it. Note that regardless of your urgency, you may not get a response quickly, as people have their own priorities to cater to as well, and only assist others here in their spare time.
Make sure you go through the room rules as well before posting.
 
 
2 hours later…
user10984358
9:46 AM
room has been awfully silent today :/
 
9:57 AM
@TheNamesAlc that's Christmas for you
in other news, ugh off-by-one problem desciption for AoC >:|
@Sam welcome! I don't have time right now to check, but [:][1][:] seems suspicious to me, I'll get back to you when I've had time to look at your problem
 
@NalinDobhal you said I first have to save Article before I can save a related model. The problem is, create_images_from_tags returns the new HTML. Do you know how to handle this?
 
@wim IIRC there was a package for scalability-curve investigations: it automatically did multiple runs with logarithmically-scaled parameter values, timed them then graphed the different series (log-log or linear-linear axes). So you could see what was overhead vs big-O asymptotic behavior. Anyone remember the name? I gave up trying to find it.
 
10:43 AM
stackoverflow.com/q/59467441/4799172 dupe (in my last comment, I'd already voted as unclear prior to edits)
 
@roganjosh Wow. What an XYWTF problem! The OP has self-deleted. I think that's the best outcome here...
 
A very unusual understanding of the language. I'm guessing they got thrown in at some deep end where they were told they needed to mash some python script into a process
 
cbg guys o/
Is there any chatroom where I can ask UX related queries?
 
11:34 AM
@wim And it's now net -328 (18 hours after posting), what is the +/- breakdown currently?
 
@TheLittleNaruto There's whole Stack for it: ux.stackexchange.com I assume they have chatrooms, but I have no idea how active they are.
 
Hi. Is there a faster way to write this:
    def func1(self, v):
        for node in self.tree:
            if node['from'] == v:
                return False
        return True
?
tree is a list of dicts
 
@wim I think np.eye is always a dense array, doesn't switch to sparse even when the O(n^2) space requirement becomes a pain, I don't think you want to do that. What if you directly create scipy.sparse.eye()?
 
@MikaelKen No. That code looks ok. But why do you call it tree if it's a list?
If you need to do lots of those 'from' tests on the same data, consider looping over the list & copying the 'from' data to a set (if it's hashable).
 
@IvoMerchiers i tried that but forsome reason it will fail a secodn time?
 
11:46 AM
If you want a one-liner, you can use this, imo also a bit more readable, but probably subjective
def func1(self, v):
    return not(any(node['from']==v for node in self.tree))
 
@smci That sounds correct. The docs would say if it's sparse. docs.scipy.org/doc/numpy/reference/generated/numpy.eye.html
 
@PM2Ring Yeah I mean I doubt @wim wants to test how the O(n^2) space requirement of np.eye() degrades performance as n scales, so why not just instantiate a scipy.sparse.eye() already?
 
@IvoMerchiers for some reason that version uses less objects but it's slower
 
@IvoMerchiers I agree it's more readable, for those of us who are used to it. But I'm happy enough with the previous version if the writer is more comfortable with it, especially while they're still getting used to the core features of Python. And extra especially if it's their 1st language, so they're also just starting to learn the fundamentals of programming.
@MikaelKen It should scan the list the same way, & do just as many tests as your version. It may be slightly slower, but there's a trick to speed it up a little.
return not(any(True for node in self.tree if node['from']==v))
I ought to mention that if you truly have a tree structure, it may be worthwhile creating a Node class, and writing some methods for it. But it's ok to use nested dicts for trees, if you want.
 
12:08 PM
@PM2Ring I expect there's an associated sequence of successive approximations to sqrt(n), and probably an Egyptian fraction sequence, and so on...
 
1:44 PM
@PM2Ring how is that faster? because it doesn't leave the genexpr until a result is found?
 
hello
 
 
1 hour later…
3:09 PM
no MCVE/ needs clarity/ debugging help stackoverflow.com/questions/59470489/…
 
@smci Out of curiousity, is a close vote the correct step when the question (in my opinion) seems salvageable with some extra definitions?
 
3:31 PM
Hi, In the following code does anyone know what use of {} means please? Google-fu is failing me. I am used to {} as a placeholder e.g. with f-strings
def add_reverse(num, max_iter=1000):
    i, nums = 0, {num}
    while True:
        i, num = i+1, num + reverse_int(num)
        nums.add(num)
        if reverse_int(num) == num or i >= max_iter:
            break
    return nums
in fact, syntax for that whole line seems odd to me
 
It's a set containing one value; num
 
doh
thank you
back to bed in shame
 
If you're stuck with this in future, the quick way to do it is:
def add_reverse(num, max_iter=1000):
    i, nums = 0, {num}
    print(type(nums))
No worries :)
 
is common to list variables in this way? i, nums = 0, {num}
 
I don't think it is, or that it helps with clarity at all, since they are not related. I thought I might find it mentioned in PEP8 but I'm yet to locate it
 
3:38 PM
Ok.. very helpful. Thank you for your time.
 
@roganjosh Have you seen seaborn? It is supposed to be built on top of matplotlib to make it look better. Or is it more of a usability thing not style
 
Hi. Anyone could point me inthe right direction here: pastebin.com/kK3Qabii ? I have a list which contains two list. If an element belongs to first list, i want to append the corresponding one from the second list.. but it looks like for me it is wrong
 
@QHarr No problem. One gotcha here is that something = {} would not create an empty set. That would create an empty dictionary. If you want an empty set, you'll need something = set(). It's purely because there's an item in it when it's instantiated that we can see it is a set, so it's no surprise that you'd find the syntax hard to pin down
 
@roganjosh thanks :-)
 
@Dair I have seen it. It's a usability thing; I just wanted to dump some things into a graph for someone yesterday but struggled to get the error bars correct. All my actual plots these days are embedded so I've just got used to JS libraries; if I use matplotlib, it's literally just dumping graphs for my own debugging use
 
3:47 PM
@IvoMerchiers I've asked the same here many times before. Yes VtC is appropriate to signal to the OP that it isn't reproducible; if/when the OP makes it reproducible I will happily reopen. They still haven't done that, we don't know func1, func2. Also the meaning of the fields res, url1, url2 woud be useful, maybe it's better to precompute df[col].str['bool'].all() for the three columns res, url1, url2. Also the OP hasn;t added any print statements to help them debug...
...Anyway this approach of dispatching df.apply(test_func) an intermediate function which computes multiple dispatch to func1, func2 seems like a pain to debug. Better to precompute df[col].str['bool'].all()so we know up-front which func is supposed to be called on each row. Maybe func1, func2 can be merged, we can't know till we see func1, 2. So the OP still has a lot of work to do before I'd consider it reopenable.
@roganjosh @QHarr : I'd say i, nums = 0, set(num) was much better coding style, unambiguous what it's doing. At first I thought it was creating a dict.
 
My personal preference would be to instantiate them on separate lines
 
@roganjosh Perhaps, but using {num} to create a set seems like the worse offender to clarity, esp. for non-Python programmers.
 
@smci Thanks. I was reading this answer: rosettacode.org/wiki/Lychrel_numbers#Python and the style of writing, in places, is different from what I am used to.
 
4:04 PM
Hi have some strange problem pastebin.com/UTZS0UxF With this code I wanted to get 10 files with 50 entries but I get just one with the name test_9.txt I am new in Python so clearly I make some mistake with code. Can someone look and give me some directions?
And in that file I get all 500 entries
 
@Pijes What is words?
 
That is my list of words
 
The first issue is that the with block is not indented to be within the loop, and you're not making any attempt to partition the output into batches of 50
@Pijes It can't be
 
@roganjosh Can you tell me that simple
 
[1, 2] + '\n'
Traceback (most recent call last):

  File "<ipython-input-48-b3b6811bf953>", line 1, in <module>
    [1, 2] + '\n'

TypeError: can only concatenate list (not "str") to list
 
4:11 PM
No, I made that words with program. That's OK. I get results what I need to get
 
It's not ok if you're expecting me to help you, though. I don't know how file.write(words + '\n') works because you're not telling me what words is
 
recbg. To be precise they told you what they "think" words is. Except as you demonstrated, it can't be a list, so there's a mismatch there.
 
I get combination of words. file.write(words + '\n') works simple. I have a problem with number of files
 
@roganjosh I read that as "what is love" in my head at first for some reason. :D
I suppose on that note, merry xmas eve!
 
Merry xmas eve mate :)
@Pijes I am asking for you to please give an example of words. If I don't see a small example of what it looks like, I'm not going to start trying to drag it out of you. It is not what you say (think) it is, and I can't help with the other problem (and I understand the overall problem clearly, so you did a good job of communicating that) without knowing this
 
4:19 PM
@smci one shouldn't write python code for non-python programmers in my opinion
 
@ParitoshSingh Getting into the 90s vibe at an Xmas party, by any chance? :P
 
@roganjosh Somewhere deep in my subconscious i guess ;)
 
@roganjosh That's domain names. like example1.com and the next line example2.com and so one.
@AndrasDeak That would be wonderful
 
4:36 PM
I'm gonna leave it with "I'm not going to start trying to drag it out of you".
 
@roganjosh OK. Happy Holidays
 
Thanks. You too
 
If someone else want's to help me when I put print (words) I get 500 domain names line by line. I just want to write that domain names in 10 files with 50 entries. The code is fine except the part I show you.
 
You should run type(words) and tell us the type. The important thing to note is to be specific. Is it a list, string, something else? etc.
 
for words in range (1, 500):
 
4:49 PM
Literally, just print(type(words))
You have file.write(words + '\n'). Immediately before that, just stick in print(type(words)) and report the result back
Tis the season for me to give it one last go at fixing this for you. None of us can help without knowing what I was asking for, though. To debug problems, it's very important that we take things in particular steps so that we're all on the same page. So, we need the exact output of print(type(words)) before we move on to the next stage
 
I get invalid syntax
@roganjosh print(type(words)
 
you're missing a closing brackets
 
Yes I get <class 'str'>
500 times
 
From the code you gave us, it's not possible to get it 500 times
this code could only run 10 loops
I suspect you included for words in range (1, 500):, which wasn't necessary
 
@roganjosh for words in range (1, 500):
Yes I need that
 
4:59 PM
We didn't ask for that, though. Please get rid of that before I make my next suggestion.
Not for what we are trying to do
Remember, we are debugging, not giving an instant solution to the problem
 
OK
 
So, once you've done that, you should get a single print-out of <class 'str'>. Please let me know when you've got that, not 500 outputs
 
@roganjosh OK. Thank you for your time
 
No problem. So, we're good to go for the next step?
I'm waiting for confirmation btw. The next step would throw out a lot of garbage until I'm sure you've got rid of that loop and have a working setup
 
cbg and Merry Christmas everyone..!!
 
5:08 PM
Merry Christmas @anky_91 :)
 
Enjoy the day :) @roganjosh is almost 25th here
@smci absolutely agreed on that :)
 
I can't delete nothing. My boss give me that code and told me to do what I need to do. That's all. I can't show you because of my contract but thank you for all help today. I learn all from you and your friends here. Cheers
 
cbg. Merry Christmas everyone :)
 
on a lighter note(becoz Christmas), i like this standup :)
 
Yeah, I have faced that!
 
5:18 PM
:)
and this
 
I love your sense for humor. I love people of India. I am not from India but love people there
 
Thank you :)
 
5:42 PM
wow, didn't even know chatrooms existed on so. thanks for the invite
 
rule 1 of chatrooms. you do not talk about chat ro..im just kidding. hello!
 
offers chai
 
this offering pleases me. I shall accept it. accepts it
 
5:55 PM
What does flask-mysqldb offer over flask-sqlalchemy?
It looks kinda dead to me. Maybe my advice should be more assertive in making the transition
 
6:08 PM
if my understanding of sqlalchemy is correct, that's backend agnostic right? This one seems to be specific to mysql as well
Oh, this reminds me, tangent but i recently found out pandas uses xlrd to read excels. And apparently xlrd is not being actively supported anymore and they themselves recommend switching over to openpyxl.
 
@ParitoshSingh Correct. But it looks like it was being developed in 2015 so I'm gonna go with the impression that it was before things were properly unified with flask-sqlalchemy (which has its own issues)
 
Oh, i see
 
Still, I think moving to flask-sqlalchemy would be an upgrade. I didn't even know flask-mysqldb was a thing until it just came up in a question... it's only afterwards that I found it looks superseded
 
unrelated but your name always reminds me of rogan ghost
and now i'm hungry
 
Agreed, it seems to have been last updated on Jul 15, but taking a closer look reveals it was a fairly superfluous patch too. I suppose a library that's essentially acting as a wrapper to a single backend database doesn't need to do too much.
 
6:17 PM
@Datanovice interesting. I would have expected it to remind you of Rogan Josh :P
 
@roganjosh synonyms. :) rogan gosht works as a standin for rogan josh
Depends on where in India you're from i suppose
 
Ah. I did not know that!
 
Curious, have you ever tried rogan josh?
 
Dec 5 at 14:43, by roganjosh
A bit meta: I just ate my first ever Rogan Josh. Quite tasty, actually; I'd always assumed they were spicy.
 
Oh haha, nice! Surprisingly late considering your name i suppose, which does make me wonder how you picked your name :P But i missed that convo!
 
6:22 PM
I needed a chat handle for AOL when the interwebs were becoming a thing. I'm Josh, and it's actually rarely taken on most sites, so it works for me
I've had it for like 20 years now in roughly the same form
 
Ah, interesting!
 
6:44 PM
I installed new version of python and changed in ./bashrc python to point to that new installation
but which python still returns just old version /usr/bin/python
instead of /usr/bin/python3.7
Should i care about this?
 
wim
what is your OS?
 
ubuntu 16.04
VERSION="16.04.6 LTS (Xenial Xerus)"
 
wim
I would leave python to point at /usr/bin/python then (i.e. system python)
the OS may be relying on that being 2.7.x somehow
 
yeah true
alright
 
7:06 PM
@ParitoshSingh or Pakistan ;)
 
Aye. Does bangladesh have rogan josh too i wonder?
 
<nobody, anywhere, is spared from my presence>
 
Actually, I was somewhat surprised when I found out it's an actual dish in India (and other places). Like, spaghetti bolognese isn't Italian, it's just something the Brits made up based on their cooking style. I assumed rogan josh was something similar.
 
If you can name it, it's probably an edible dish in india. :P
 
7:11 PM
Hahaha
 
And sometimes even if you can't name it, it's an edible dish. ;)
 
@roganjosh it's either Persian or Kashmiri defo not a British dish like Balti chicken lol
 
Is a korma authentic at least? I do so badly when trying to eat spice, but maybe I'm just ordering lies when we go to Indian restaurants
 
7:27 PM
Both. Korma is authentic, but you're also definitely ordering "half-lies", or in any case, many places will slightly modify dishes to account for local tastes. So it would not quite be exactly the same as the same dish in India.
 
This pleases me. Python instead of Javascript
 
@ParitoshSingh Ok, I can live with that :)
Oki doki, off out. Have a great Christmas guys. And welcome to the python room, @Datanovice :)
 
Have fun too!
 
7:42 PM
@roganjosh Happy holidays mate, thanks for the warm welcome.
 
wim
7:55 PM
@Dair something screwy in their unicode
>>> len(chr(128013))
2
 
8:08 PM
Welp, they tried.
 
#In console browser
temp = '🐍'
"🐍"
temp
"🐍"
temp.length
2
So i suspect this is js to blame most likely
 
Javascript is always to blame.
 
Just the way things should be in the world. :P
 
8:23 PM
abs_abs_sub_le_abs_sub great name for a function.
 
wim
8:57 PM
So, what does js do? Surrogate pairs, probably? if they were implicitly doing a utf-8 encoding it would be length 4..
 
Aye, seems that way.
[link](https://flaviocopes.com/javascript-unicode) suggests javascript deals with utf-16.
> JavaScript strings are all UTF-16 sequences, as the ECMAScript standard says:
When a String contains actual textual data, each element is considered to be a single UTF-16 code unit.
..apparently ive completely forgotten how to add links. and i swear i did this earlier today
 
10:01 PM
@ParitoshSingh multiline breaks regular markdown
 
Ah, gotcha ty!
Oh and merry xmas!
 
10:20 PM
@ParitoshSingh thanks, and to you also
 
10:36 PM
@ParitoshSingh Hi have you worked beautifulsoup, pagination?
 

« first day (3356 days earlier)      last day (1608 days later) »