« first day (2801 days earlier)      last day (2372 days later) » 

00:23
you brought this upon yourself by using fortran!!
gone!
00:38
@OlivierMelançon (probably I'm going to be hated for saying this) but bah who cares, there is no MCVE.
00:56
About the self.__dict__ question?
I'm following that question and I'll make sure OP adds the MCVE, but honnestly this is why the bug occurs for sure.
Erm no, I meant my post, but I'll read that as well, it looks interesting.
I'm confused, which post?
Oh that! Yes. The thing is that there are two reasons this may happen: 1) OP just did not inlcude the line that indicate that it's a loop 2) OP confuses continue and pass and does not know that continue must be used in a loop.

If there a is a loop, then yes maybe the problem is the indentation, but since there is another very likely explanation, I would not assume the former
Could be either but there is definitly an indentation problem. The print statement is two spaces out, beyond that I agree it is imposible to say.
And they are ignoring pep8 :(
01:08
Yes, there are actually tons of errors in that code
And you pointed an actual error, just not the one that corresponds to the question. Anyway, it's just a bad question
Laurel. I see you confusion, there is no MCVE for your answer either.
But looking at it I would say you are right, and the OP had some similar vision in mind.
@Simon I love the import on the last line of the code. :)
They are actually more useful than you might realise. For example if you want to add code during future releases, it will already be ready to use, without needing to type any extra imports. :p
As long as it goes on the bottom that is.
01:25
But yeah, don't answer rubbish like that. Sometimes an OP can be coached into fixing a poor question, but if they don't respond to comments, and / or the question remains an unsalvagable mess, close-vote and move on.
Ok.
Anyway, bedtime rhubarb.
@OlivierMelançon I like your answer, but we probably have a good dupe target or two for that question. ;)
Which one? The dict one?
Yea... sorry I have to start going dup hunting more often, I just have not been here long enough to have a good feel about what probably has a dupe and what does not. But that one probably does yes
After all that time, everything must have a dupe, no?
most things, yes
So we are just dupe finders now?
Can I get rep for finding dupes?
01:36
upvote the corresponding feature-request if you want that :P
01:49
@OlivierMelançon No, but we should make an attempt at looking for dupes. Don't waste too much time on it though.
I'll work on that
If you suspect that a question should have a good dupe target but you can't find one you can always mention it here.
So I don't think it was requested to have rep for duplicate hunting, but the badge idea is here and seems to be well-received
@PM2Ring Fair point
Oh, requests for a little bit of rep for dupe hunting have been made, but there's disagreement on how it would work. And no desire by Stack Exchange to implement it.
My rule of thumb is if I can't find a decent dupe in 5 minutes then just write a new answer.
In five minutes, most post that likely have a duplicate have 12 answers
02:00
The main thing is to quickly close obvious dupes so we don't get that flood of low quality dupe answers.
Are dupe questions deleted?
If they have no answer
If A good dupe is hard to find, then in many cases it will take more than 5 minutes to write a good answer. And of course we can down-vote bad answers. ;) And some people will delete their bad answers when you point out the flaws.
@OlivierMelançon Not automatically. We manually delete them if they're really common, and provide no benefit to people doing searches.
Someday I'll be a grown man allowed to delete stuff
The system keeps dupe questions because they act as portals to the dupe target, but you don't need a hundred near-identical portals.
@OlivierMelançon :) We're happy to receive deletion suggestions in here. Don't go searching for rubbish to delete, that's an endless task. But it's ok to mention bad stuff you stumble over while looking for stuff to answer or while doing dupe searches.
FWIW, I often make constructive criticism comments on bad answers. Sometimes the author fixes their answer, and if they do I give them an upvote, if they don't then I down-vote. But quite often they simply delete the answer, instead of fixing it. Sometimes that happens because they realise that if they fix the answer it would become too similar to an existing answer.
I probably delete more answers via comments than I do with actual delete votes.
02:38
Quick question, is there a good way with python re to match two identical adjacent characters?
@OlivierMelançon Yes. Use a backreference.
Thanks, didn't remember that
Here's a silly application of that: stackoverflow.com/questions/3296050/…
The best thing about Kali Linux is that you can be 99% certain that a Kali question will be close-worthy before you even read it. ;)
@OlivierMelançon It's not very efficient, but it works fast enough if the number isn't too big. I guess you could even create a regex prime sieve, if you were a regex genius. Although I guess that probably needs an explicit loop.
03:08
I needed it for something way simpler than that, but it is really cool
 
3 hours later…
06:46
Does max() work in constant time on sets? I hope so.
@ParthKohli No, because it still has to loop over all the set members to determine the maximum.
What's your use case? There may be an efficient way to do it, eg using a heap.
I thought it should have been in constant time, since sets are stored in an ordered manner. :/
ordered by a hash modulo a constant, yes. How does that help you figure out the maximum?
No, sets use a hash table, so the order of the values depends on the hash values of the items and on the order of insertion.
I just want a set structure (add, remove, ...) and also find maximum in constant time (in C++, for example, it allows me to do that *s.rbegin())
@Aran-Fey oh, okay. so a Python set is like an unordered_set in C++.
06:56
You could create a set class that keeps track of the maximum. That will be fast most of the time, except when you remove the current max, since that will force the maximum to be recalculated.
Do you need all the set operations, eg fast membership & intersection testing?
58
Q: Why are there no sorted containers in Python's standard libraries?

Neil GIs there a Python design decision (PEP) that precludes a sorted container from being added to Python? (OrderedDict is not a sorted container since it is ordered by insertion order.)

thanks - I was just reading that
07:22
I hate working from my smartphone
@PM2Ring Can I request as well? There were a few cases where I saw some really delete worthy questions.
07:40
Cabbage from Bengaluru :-)
@Simon Of course. We judge questions by their quality, not by the person who posted the delv-pls request
 
1 hour later…
09:41
@Aran-Fey that's great. Thanks.
the only reason lower-reps are not encouraged to post -pls requests is that they often lack the experience to tell what should be -plsed
10:00
So as long as I read this meta.stackexchange.com/questions/58842/… thoroughly I should be OK
10:17
@Simon I would say that's a grey one. Fits the bill for cv, but at least deserves a few comments, but it's likely a dupe.
 
2 hours later…
12:46
@Aran-Fey re:
An endless loop that takes screenshots is not a good way to make a recording. — Aran-Fey 4 mins ago
I'm reminded of the old story about the manager who was working back late and couldn't figure out how to send a document to the printer. So he photocopied his monitor screen. This was back in the day of CRT monitors.
He sounds like a problem solver :D
That's why he was a manager. :)
I admire his ingenuity, but lament his ignorance.
I tried to find an analogy that makes it obvious why it's a bad idea, but there are so many problems with it that it's hard to come up with something that really fits
But I rest easy knowing that it'll be painfully obvious when/if the OP gets that code running
13:08
Making a movie with a collection of camerae obscurae?
Can you fit the frame rate problems into that analogy?
No idea :D camerae obscurae need really still subjects so that'd probably be worse
13:35
Actually I don't know how long it takes to take a screenshot. The analogy might be more accurate than I thought
13:48
hello, little q: how to create a dict from string to list?
Could we have an expected output and input please. Thank you.
ok
'cluster_name_1' -> ['course1', 'course2']
so I can do the_dict['cluster_name_1'].append('course3')
And the input is a string? Like input = "'cluster_name_1' -> ['course1', 'course2']"?
...
thank you
@AndrasDeak "hold the monitor absolutely still"
13:59
I think the question was meant to be "How do I write a dict literal where the key is a string literal and the value is a list literal"
Something like s='cluster_name_1'; l = ['course1', 'course2']; the_dict = {s:l};?
I think so, yea
14:14
Closing as unclear
Simple questions need clarity too
14:45
hi all
I have a pandas dataframe which I read in from a csv that is in principle made up of floats. However it turns out that various symbols have been used for NaN which I am trying to find. How could you print out all the elements of a pandas dataframe which can't be converted to float?
what is the dtype of the corresponding column? Object?
does converting to floats give nans or an error?
15:02
object and yes it gives errors for entries like #
15:22
You can try pd.to_numeric with errors='coerce' to force all the non-convertible elements to NaN.
And then .isnull
 
2 hours later…
16:56
Any suggestions how I best reply to this:
Didn't work for Linux. However, by mac OS works fine. Why official documents are not correct and lead to issues? — Oleksandr 15 mins ago
I'm thinking of saying the sudo command is dangerous and should only be used as a last resort, and that that command is not required in all cases/common problem on Linux/Mac
@miradulo thanks!
I think my new SO question must not make sense. I have a pandas dataframe with lots of NaNs in it (and floats). I want to convert it to a scipy matrix so that the NaNs are treated as missing data. That is just removed entirely.
Is that easy to do?
-1
Q: How to convert pandas dataframe with NaNs into a sparse scipy matrix

AnushI have a pandas dataframe df with a lot of NaNs in it. I.e. 0 NaN 77.0 NaN 78.1 80.8 92.0 75.0 88.0 83.0 NaN ... NaN 83.2 NaN NaN 78.0 NaN NaN NaN NaN NaN 1 70.0 80.0 90.0 85.8 NaN 87.5 82.5 NaN 83.0 NaN ... NaN NaN 68.3 NaN NaN NaN NaN NaN ...

"Scipy matrix"?
a scipy sparse matrix
df.values gives you an array of data
that would include the NaNs right?
17:01
Probably
You can .fillna with zeros if you want that
do the zeros get omitted when you then convert it to a sparse matrix?
I mean, what happens to real zeros?
I'd expect them to be removed from sparse. Try it for a 3x3 array and see what happens
oh I see.. I had a different idea of what sparsity meant
Sparsity is a feature of having "few" nonzeros
"Few" usually meaning less than O(n^2)
thanks.. I think pandas has a more general concept where you can define the value not to be zero
but I understand why my question was stupid now :)
17:05
You can store dense matrices in sparse format but that defeats the purpose (slower and more RAM)
I got it working now, thanks
No worries
Masked arrays may be relevant, don't know if those play nicely with scipy.sparse (I'd guess not)
Anyone know how to use subprocess.run? When I use subprocess.getoutput it works but run does not.
command = ['./parser/cli.js', "--input=\"{}/*.{{view,model}}.lkml\"".format(repo_url)]
p = subprocess.run(command, stdout=subprocess.PIPE)
Always ignores the --input
Did you check with a simple script that it really doesn't work?
I'm thinking a bash script that prints the command line args
@AndrasDeak Yes it works fine...
It works fine also using getoutput. Just doesn't work with run
Works but doesn't use the --input param I pass.
17:20
OK
@Johnston try without the quotes after --input=
17:34
@Aran-Fey Let me try that
@Aran-Fey that worked... Why did that work?
no clue. I don't like to think too much about it. I just use that knowledge to fuel my dislike of text-based interfaces
@Aran-Fey happen to know how to use >> to send the output to a file with run?
open a file in append mode and use it as the process's stdout
like that
Oh that makes tons of sense. Thank you @Aran-Fey
too broad / unclear / no MCVE stackoverflow.com/questions/50898848/… and no OP ;)
18:07
actually, OP version is not supported
18:40
sunday cabbage to all!
18:57
Hello!
given a string of 1's and 0's, how write them into a binary file? Consider that the string is really huge, so performance matters.
I tried my_file.write(bytearray(bits_as_str, 'ascii')) but it wrote as text
where's bits_as_str from?
oh, that's your string
you probably need to group your bits by eights and convert them to bytes first
19:01
with int(group, 2)?
that would be my first guess, I don't know about performance
yeah... that's exactly what I first tried but it's too slow :(
Did you google for efficient python bit thingies? I suspect this has come up before
I found out how to efficiently convert a list of int, not a string of bits
found stackoverflow.com/questions/10237926/… with first search hit, second answer uses a bitarray module, sounds worth looking into
19:07
Hmm. 3 downvotes and a comment just saying "It does not make sense mathematically." on my latest answer. Not sure whether I'm actually doing something wrong or I'm just getting downvoted by people who don't understand the math.
-2
Q: Is (k choose n) operations doable in polynomial time?

joe-tomI have an optimization problem that requires (k choose n) operations, We already know that (n choose k) is in polynomial time. Unfortunately, it appears to be exponential at the moment, but I could not find any literature on the subject.. :(

Perhaps some of those answers are really meant for the question
and again some people aren't aware that algorithm questions are on topic here (even though they should be better :P)
I also don't really understand the question but that's probably my fault. I mean there's no asymptotics to speak of when k in (k choose n) is fixed
I also don't understand O(0); if it's constant-time then it is O(1), right? I can't even make sense of O(0) mathematically (but again, given your background and mine I suspect this is my fault)
skimming that answer it seems to me that only a no-op is O(0) which is what I had in mind; it makes no sense
19:17
I'd tend to agree with that
I don't want to pollute that comment thread even more, but I disagree with Basj in that "k(n) choose n" is a special case of "k choose n". The two are very different. It's as if you had an O(n^2) algorithm where n=exp(m) for your actual size m
You can change the complexity of an operation by renaming two variables? Mathematicians sure have it easy
aaand self-deleted...
there goes my educational comment
@AndrasDeak Worked like a charm! I guess I didn't search for the right thing. Thanks!
no problem
19:31
in a few days we'll pass user # 10 million...
The hold message for the (now-deleted) question is weird. "put on hold as unclear what you're asking by joe-tom, Paul Hankin, Basj, miradulo, Andras Deak 3 mins ago" - but joe-tom is the OP.
huh, that's weird
self-aware OP
I thought that was only for dupes
@coldspeed I only see 239506 pages of size 36 (give or take the partial page), that's only 8.6M
huh, I saw a user with # 9.95M
I guess what you're looking at doesn't count deleted users
19:44
probably deleted users
 
2 hours later…
21:14
Hello, everyone. Please, how can I set color density (light red or dark red) to see frequency density to a X,Y point in a scatter plot?
Hello. Please clarify. You can set a given opacity for your scatter markers, in which case where there are a lot of overlapping points you'll see darker colour. Otherwise it's not trivial how you get a measure of density from a scatter dataset.
A hexbin plot may help you with the latter.
I think opacity is what I want
How i do that?
by googling
I don't even know the library you're using
21:22
ok
matplotlib
but unless it's plotly I'm sure it has nice documentation :)
Ok =)
"matplotlib scatter opacity"
the keyword is called alpha
Thanks

« first day (2801 days earlier)      last day (2372 days later) »