« first day (2595 days earlier)      last day (2361 days later) » 
00:00 - 18:0018:00 - 00:00

12:13 AM
@piRSquared Oh no, I did not see it earlier. It looks good. As usual, was not accepted in preference to another certain someone.
 
Mine is faster too
I don't know how much I should whine about, aka argue about mine being better. I'm inclined to let others vote and let OP decide. But so often OP doesn't know better and votes don't go as you'd expect and I'm left wondering what is best for future readers
I don't dwell on it... Cuz I'd have too many instances to dwell on... but I still would like to have a go to approach to deal with it
 
I don't really think there is a "protocol" or procedure... OPs are fickle beasts
 
@Simon it looks as tho u have an identicon imposter
 
12:29 AM
I don't understand could you explain further?
 
You are first one, imposter is last one.... most similar looking identicons I've seen yet
 
Similar hashes!
 
4th one? Yep your right.
maybe he's trying to copy me.
Who'd bother? Just seems Iv'e broken the internet with my script. : (
I noticed your comment @cᴏʟᴅsᴘᴇᴇᴅ in the question above "@LouisBernstone Don't forget to accept the answer you decide to use." . I answered someone's question and they said it worked but never accepted it should I put some comment up like that with the link?
I'm not the only one it happened to. They never accepted an answer since they started using the site.
 
12:45 AM
@Simon Yes. It is okay to ask for a user to accept your answer... once or twice at most. Don't ask unless you know their question was answered by you.
 
I am not sure if it did answer their problem what do you think: "You are a saint - It worked! You helped me learn how to do this in the future with other files as well! thank you!".
 
It sounds like you did answer their problem?
 
I am just asking because I don't want to seem rude or anything.
 
You shouldn't advocate the use of eval.
And yes, you can ask whether you solved their problem or not, before asking them to accept your answer.
 
Second. I made a real mess at answering it so it would be good to be able to mark where the answer is. And it was a few weeks ago.
 
12:57 AM
I usually only ask people about accepting answers if I consider the top answer wrong or harmful. I don't want my answer pinned to the top if the questioner stops using Stack Overflow and someone comes along with a better answer.
 
Good point.
 
@user2357112 How does the questioner's use of SO influence your decision to have your answer pinned to the top?
So they won't be able to unaccept your pinned answer if a better one comes along?
We should keep in mind that votes determine usefulness more than the fact that your answer is accepted.... very often it is not the best answer that an OP accepts... rep and other factors influence that.
 
@cᴏʟᴅsᴘᴇᴇᴅ: Yes, because a user who isn't there can't unaccept.
Answer ordering means a lot more to me than vote counts, because answer ordering determines what people will actually see.
Answer ordering is also an extremely strong driver of vote counts.
 
Yes, but if an answer is so obviously inferior to other ones (that are not accepted), votes almost always reflect that.
I'm a long time SO lurker, and I scroll down beyond the accepted answer because more often than not, it doesn't solve my problem
 
First, in my experience, the votes pretty often don't reflect that.
Second, even when they do, it's not going to change the fact that people are going to see the accepted answer first.
 
1:16 AM
There's been a long standing meta discussion regarding un-pinning accepted answers from the top... hasn't gotten anywhere though.
I am having just... so many instances of people plagiarising my answers and getting away with it just because they edit their answers during the grace period
 
Harsh reality unfortunately.
 
I wonder how much that kind of behavior varies by tag. I almost never see that kind of thing.
 
In the main python tag, it happens, quite often.
Actually, please see for yourself: stackoverflow.com/a/47446132/4909087
It doesn't happen in the numpy or pandas tags... except with jez...rael.
 
Not in cx_Freeze or tkinter.
You are right use regex even almost the same code.
 
That doesn't look like plagiarism to me.
 
1:30 AM
@user2357112 Their initial answer stopped with "testing string"[0] == "t". And was edited later in 3 stages
 
That's still very weak grounds for a plagiarism accusation.
I've been on both sides of a situation like this before, minus the argument.
 
If you are going to take the trouble to write a long answer using regex for a string comparison problem, and then add string comparison as an "afterthought", it's quite likely your thoughts were influenced by some other answer
Obviously, I have no proof of plagiarism because their answer was edited during the grace period.
 
Heck, I think I've been in this situation with Martijn a few times.
 
And now they edit their answer to "Removed due to similarities with cᴏʟᴅsᴘᴇᴇᴅ's unique, ingenious, fantastically amazing, 10/10 lollypops answer (refer to comment argument)."
 
That's just them getting annoyed at you assuming bad faith and calling them "tough guy".
 
1:37 AM
How are called functions that work like this one: mylist.sort() or 'string'.join(). I mean, that are a variable.function(args)?
 
hah. Well, their answer only becomes that much worse. So whatever
 
1:54 AM
Still flogging that dead horse
 
@AndrasDeak What are you talking about?
 
You can flag suspected acts of plagiarism. And you can stop FGITWing if the competition is getting on your nerves. But insistently whining here won't change anything.
Other than our blood pressure, that is
 
Venting helps
I posted that answer 18 minutes after the question was, I hardly call that FGITWing
Apparently, answering questions = FGITWing now
 
I can only see you whining, I didn't check the link. If you didn't FGITW, my first suggestion of flagging applies
but anyway it's bedtime for me
 
is it possible for a single processor to run two threads at the EXACT SAME TIME?
 
2:02 AM
OK
 
Wow I love Izaak van Dongen's icon. Psyduck.
Rhubarb all.
 
2:19 AM
@Trey You can't, that is physically impossible. A processor can't do 2 differents things at the exact same moment (talking about miliseconds or less).
 
@EnderLook but the cpu has to stop to execute one of the threads right?
like, it'll put one of them on hold
?
 
2:36 AM
@Trey Yes
The processor would process both thread almost at the same time. I mean, for example: 1000 times per second the process would stop processing one of the threads and process the another a little, like if it was: 'ABABABABABABABABABABABA....' in one second, were A and B are the two threads that you are talking about.
For example, my computer has 3.5 GHz of processing, that means each second (I "think" I am not 100% sure) it make 3,500,000,000 times "AB". But remember something: your threads aren't alone, the CPU must also process the whole OS, all the programs you are using and even some background task.
 
2:53 AM
I've search a little and I found it doesn't do "AB" 3,500,000,000 times per second, it's able to change the electrical flow of energy to the CPU 3,500,000,000 time per second, and each one of your threads can give several instructions to the CPU, where each instructions could be made of several of logic operations, each one again made of several electrical flow changes in the CPU.
 
They should've made this more clear in the articles.. saying that a single core can execute threads simultaneously is misleading
 
@Trey simultaneously != concurrently
 
 
1 hour later…
Anyone know of a good site to get remote python jobs for a newbie
 
4:46 AM
cabbage
 
5:09 AM
cabbage, frands
 
whats cabbage
 
@SandeepKadapa a leafy green or purple biennial plant, grown as an annual vegetable crop for its dense-leaved heads
 
@JGrindal Good one. My question is why everyone texted cabbage?
 
@SandeepKadapa Check out the room rules: sopython.com/chatroom
 
6:11 AM
after logout out back button issue how can i solve this in django project ? please help
 
@harivanskumar You're going to need to be a little more specific than that.
 
6:38 AM
means
?
 
Means what it means
 
after logout out back button issue how can i solve this in django project ? please help
 
garlic
@harivanskumar Please read sopython.com/chatroom And avoid spamming. Thanks.
 
7:17 AM
@PM2Ring looks.like you were closer to whatever it was the OP was doing on stackoverflow.com/questions/47439594/… :)
 
cbg
@harivanskumar See How to Ask
 
Cabbage
@JonClements Your solution is rather cool, but I guess mine was easier for him to control with his decorators.disable_docstring_change().
 
7:34 AM
@cᴏʟᴅsᴘᴇᴇᴅ He gets notified site-wide :)
 
Oh, that's cool... wasn't aware!
 
Can't ping self though, ha!
 
cbg all
 
@cᴏʟᴅsᴘᴇᴇᴅ Haven't you noticed chat pings in the In box, alongside pings from question and answer comments?
 
Now he can :-p He'll have to leave chat for that.
 
7:38 AM
Yes, but I thought those were sent if I didn't see/respond to a notification within x time
It makes sense now
 
Sure, so if someone gets pinged in chat, but they aren't active in a room, they'll get a ping in the In box.
 
And you can only ping someone using @ from a room they've been active in, in 7(?) days I think
There's also a user setting to enable "faster inbox delivery" - which I think makes notifications pretty much immediate or they get queued up and done every 15 mins or so
 
Cbg, @ReblochonMasque! Good to see you visiting here.
 
I probably should be able to remember exact details but meh...
 
7:45 AM
thanks @PM2Ring, my first time behind this curtain.
 
@Simon You should definitely inform OPs who never (or rarely) accept about accepting, but do it in a diplomatic way. I have 2 canned comments which I've adapted.
On my answer: "If my answer has helped you, please consider accepting it." On the question: "If one of the answers below fixes your issue, you should accept it (click the check mark next to the appropriate answer). That does two things. It lets everyone know your issue has been resolved to your satisfaction, and it gives the person that helps you credit for the assist. See here for a full explanation."
@user2357112 Fair point, but IMHO a page doesn't look complete without the green checkmark, and I think it's important for OPs to learn that they ought to reward those who help them. Of course, the accepted answer is often not the best answer, of all the people contributing to a page the OP is often the least qualified to judge the answers. But that doesn't really matter!
@ReblochonMasque It's pretty quiet here at the moment, but it should pick up pace in an hour or so.
In the mean time, you might like to take a look at our collection of common questions, which can be very handy when you're looking for dupe targets: sopython.com/canon
 
hehe, thank you !
 
8:01 AM
@PM2Ring oh, now I'm curious to see if I know all the ones listed there =]
Well, that didn't take long at all. Had no idea about this one: sopython.com/canon/96/…
 
@ArneRecknagel That's a great one. It can be very bewildering when it happens because it can make you feel like your Python installation is broken.
 
@PM2Ring: I say it matters, a lot more than any 15-rep reward.
 
If you see any great questions and answers that you feel would be good to add to that list, please let us know.
 
It might be a good idea to crawl questions from a tag and count duplicate-reference links
Maybe I have time to do some crawling today
 
@user2357112 The 15 points are nice, but I agree they aren't thatimportant. Accepting an answer is a Stack Exchange institution. Yes, it's flawed, but a page without the green tick doesn't have the same impact as one that does.
Any future readers should realise that the accepted answer may not be the best one, especially if the next answer has a higher score. And of course score isn't that great of an indicator anyway. People should treat accepts and scores as helpful indicators but judge each answer on its own merits, and perform their own tests of the code.
 
8:12 AM
[cv-pls] stackoverflow.com/questions/47450422/… too broad / unclear
 
@ReblochonMasque Don't forget the "tag:" part [tag:cv-pls] -> ... Also, gentle reminder to wait 10 minutes to report a post here (unless it's a duplicate)
 
ah, yes, the tag:, and the 10 min lag... sorry, getting the hang of it.
 
cbg
 
8:28 AM
cbG
@JonClements That and the whole 'common questions' list are quite a good read. I will be the king of python trivia until garbage collection throws most of this out again.
 
@ReblochonMasque With a post like that, it's extremely unlikely that the OP would make it answerable within ten minutes, so we can bend the 10 minute rule in cases like that. But it's still nice to post comment first so the OP doesn't feel they're being punished by some impersonal machine.
 
Agreed, thank you @PM2Ring
 
8:44 AM
@ArneRecknagel I'm not sure how often those things are updated these days but if you have ideas of things to add/amend we'll be happy to hear them :)
 
I lack the experience to know well enough what is common. But I'll try to have a program figure it out for me, nothing like writing some ML code to bring variety into my day of being an ML dev
I should just be glad I like my job I guess
 
Should this be closed as POB / too broad, or should we allow some answers to show how to avoid the Arrow anti-pattern in Python? stackoverflow.com/questions/47450810/…
 
If you're going to leave it open, make sure the question gets an answer worth keeping it open for... or else... smash that CV
 
@cᴏʟᴅsᴘᴇᴇᴅ I tried to address the points in a comment, do you think that's complete enough for a full answer?
 
9:03 AM
No, I don't think so, because it's half an answer and half a request for clarification.
 
@ArneRecknagel Your remark about try...except isn't completely valid. Sure, the code in the try clause should be minimal, but you do sometimes get nesting because you may have to wrap some code in the except clause in a new try...except.
 
@PM2Ring True
 
I decided to close that question, since it's turning into a discussion in the comments.
 
9:19 AM
Anybody up for a little dupe hunting? stackoverflow.com/questions/47451483/…
 
EAFP is great, and can simplify code. Exceptions are relatively quite efficient in Python compared to many other languages. OTOH, exceptions primarily should be used for stuff that's exceptional. When used properly, try..except code can be much faster than equivalent if...else code, but that's only true if the exception is rarely raised. If the exception is likely to be raised more than 5-10% of the time then it will be slower.
 
Cabbage
 
@PM2Ring I think I once read that a try except is just a prettier goto, and has the same property of making code hard to read and test. Not that I subscribe to that idea, but I kind of see the argument that it makes program flow hard to predict
 
@ArneRecknagel That’s only true if you put too much into your try/except.
But yeah, everything is pretty much a goto. if/else definitely are. And function calls could be interpreted as gotos as well.
 
9:31 AM
@ArneRecknagel Well, it is like a goto, but worse, since any statement in the try clause can raise the exception, but that's why you minimize the code in that clause.
 
@poke But the difference to if..else and functions is that you can still say that the code will, after encountering say, an if/else block at lines 30-40 continue to run the code after line 40. Raising an exception will completely break out of what should have happened after the exception, had it not occurred.
 
Goto per se isn't evil, it depends how you use it. When Djikstra wrote his famous "goto considered harmful" essay, it was normal for people to write horrible unstructured spaghetti code. At least with try...except the branching can't go backwards, so the linear flow is still mostly intact.
 
Exception raised: label "considered harmful" not found
 
How would you set the __str__ for a function?
I've seen this for classes: stackoverflow.com/questions/8144026/…
Was curious to see if the concept can be extended, somehow.
 
9:42 AM
@cᴏʟᴅsᴘᴇᴇᴅ You can create a callable type
 
@poke You mean a class with __call__ that you call as a function? Ah, I see
 
Yup
 
Yes, that is pretty elegant
 
>>> def foo():
    print('x')


>>> class FooType:
        def __call__ (self):
            print('x')
>>> foo = FooType()
Those two things to mostly the same
Except that you can add a __str__ to the latter.
 
Some day, I'll understand the purpose of every __magic__ method out there.
 
9:46 AM
You could also make a decorator, like this:
def str_this(str_func):
    def wrapper(f):
        class FuncType:
            def __call__ (self):
                return f()
            def __str__ (self):
                return str_func()
        return FuncType()
    return wrapper
 
@cᴏʟᴅsᴘᴇᴇᴅ I don't want that
 
def my_str():
    return 'This is the __str__ for the function'

@str_this(my_str)
def foo():
    print('x')


>>> str(foo)
'This is the __str__ for the function'
>>> foo()
x
 
@cᴏʟᴅsᴘᴇᴇᴅ it would mean that Python stopped developing :D
 
@poke I see you have some great ideas... want me to post a question? It'd be great if you could post everything there
 
Haha, if you want to :D
 
9:48 AM
@AnttiHaapala Haha... I guess I'll have to be content with never knowing everything then
 
copies poke's text in preparation to answer the dupe target
 
@RobertGrant lol.
 
Before that, I've to make sure it isn't a duplicate :P
 
Yeah, that’s a good idea :P
 
It doesn't appear to be. Oh well, we'll find out once I post.
@poke Posted!
(I can't share links to fresh questions here :( )
 
9:57 AM
I’ll find it :)
Answered! :D
(And reading the question now to make sure I covered everything xD)
 
hey guys , good after noon :)
i stuck with mysql-python installation, using cmd as well as pycharm, i m trying since 3 hr. can anyone please guide me
i installed mysql connector from oracle
and downloaded binary files of mysql-python but not able to install , getting error _mysql.c(42): fatal error C1083: Cannot open include file: 'config-win.h': No such file or directory
 
Ah, you covered it all. Looks great. Will accept when I can.
 
That user made a very good point though. Will be looking into it
@cᴏʟᴅsᴘᴇᴇᴅ Don’t accept yet, I want to look it over again in a bit. But I have a meeting now, so rbrb in a bit
 
Sure, will leave it open
 
10:13 AM
yesterday, by Code-Apprentice
315
Q: Why does man print "gimme gimme gimme" at 00:30?

Jaroslav KuceraWe've noticed that some of our automatic tests fail when they run at 00:30 but work fine the rest of the day. They fail with the message "gimme gimme gimme" in stderr, which wasn't expected. Why are we getting this output?

this is so awesome :d
now at 1000 upvotes :D
 
10:25 AM
@AnttiHaapala I also linked to that question, somewhat earlier: chat.stackoverflow.com/transcript/message/40121892#40121892
 
10:59 AM
:D
 
morning (just)
 
11:25 AM
@cᴏʟᴅsᴘᴇᴇᴅ I’ve added a bit to the answer, so now I’m happy with it.
 
I have an ndarray and some rows are like -- 0 0 and anything that has a nan, I can do a numpy.nan to get where the nans are but the next step is to delete a row that has a nan and replace it with two rows. how do I do that?
def do_it(data, a, b, c, d, e):
    gender = data[:, 0]
    weight = data[:, 1]
    height = data[:, 2]
    assert (len(data) == len(gender) == len(weight) == len(height))
    where_are_nans = numpy.isnan(gender)
    # gender[where_are_nans] = get_random_value()
    test_calculate_probability()
    logging.debug(where_are_nans)
    for row in data[where_are_nans]:
        zero = calculate_probability(
            0, row[2], row[1], a, b, c, d, e)
        one = calculate_probability(
            1, row[2], row[1], a, b, c, d, e)
 
11:48 AM
cabbage
@kush what do you mean "replace it with two rows"?
 
cbg
so where there is a -- a b in a row, I now need two rows

```
0 * p(0) a b
1 * p(1) a b
```
 
also, gender and weight and height can't help but be of the same length since they are all columns of the same array
 
Hey @JohanLarsson There's some nice blues on 2RRR for the next several hours.
 
also I wouldn't call len on an array, I'd explicitly use .shape[0]
also, what are those -- values? Are you actually working with masked arrays?
 
missing data
 
11:52 AM
that's not an answer to my question
>>> numpy.array([1,numpy.nan,2])
array([  1.,  nan,   2.])
>>> numpy.ma.array([1,0,2],mask=[False,True,False])
masked_array(data = [1 -- 2],
             mask = [False  True False],
       fill_value = 999999)
 
what is the difference specifying the fields in Django( example specifying fields in the model form) as tuple and list? Same as the reason of python datatypes??
 
@PM2Ring thanks
 
@AndrasDeak ok deleted the assert because I don't need it
 
@AndrasDeak (or .size in case of a 1d array)
 
is the for loop a bad idea?
is there a way to do this without a for loop?
 
12:02 PM
well with numpy you should always avoid native python loops, because if there's a vectorized alternative then it's almost certain to be faster (depends on the operation and the shape of the arrays involved, of course)
 
because I just want to replace the nan row with two rows and I have a fixed rule of what I want to do
these aren't big... maybe 100 rows at max
 
You should still put together a dummy example with 3 rows, i.e. an MCVE. I don't have the time/enthusiasm right now to figure out some input for you, and I suspect others will feel similarly
you also haven't given an answer regarding the type of your data, and I don't mean to pry that information out of you
 
yeah it is just as simple as creating a new text file
Gender	 Weight	 Height
-	0	0
1	1	1
0	0	1
and then I read the file with something like
def read_input_numpy(input_file):
    data = numpy.genfromtxt(input_file, delimiter='\t', skip_header=1)
    return data
 
In [11]: read_input_numpy('foo.txt')
Out[11]:
array([[ nan,   0.,   0.],
       [  1.,   1.,   1.],
       [  0.,   0.,   1.]])
I don't see --, as expected. Make sure this doesn't make any solution irrelevant to your actual problem
(masked arrays and regular ones are pretty compatible, so hopefully this is fine)
 
oh yeah sorry they are nan not --
 
12:13 PM
:|
So what's the p(0) and p(1) supposed to be in the replacement rows? Essentially constants?
 
I mean the numpy.isnan works perfectly
yes
 
well p(0) and p(1) can be one of eight values depending on what row[1] and row[2] are
 
so instead of the first row you want to place two new rows, [[0*p(0), 0, 0], [1*p(1),0,0]]?
 
yes sir
 
12:14 PM
so they are not p(0) and p(1), but rather p(0,a,b), p(1,a,b)
 
well they're actually p(0, a, b, other input)
 
OK. This is the point where your problem specification is clear and unambiguous.
 
wow, that looks like a mess
 
I thought I wrote beautfiul code
 
12:19 PM
you should at least set those very_long_keyword_arguments to default to those always-recurring values, then you only need to pass gender/height/weight a dozen times
 
ah that would be nice
 
also I believe np.isclose is symmetric in its arguments (correct me if I'm wrong), in which case you can just pass two arguments without using the a=, b= keywords
 
yeah it doesn't matter which one is larger, I just care about the absolute difference
 
also, I have a very strong feeling that calculate_probability could be written more elegantly, which would also let you store all those named variables in test_calculate_probability more dynamically
but for that I'd have to understand that wall of text and I don't have time for that right now :P
you should try replacing those many ifs with a single arithmetic expression
it's not necessarily possible
 
no, it is possible... I don't even need half the cases because I could just one minus p(0) to get p(1)
 
12:27 PM
"Huh, some loser got a mod message and is now reporting a bug on meta. Must've done something bad. Oh, it's just @wim" :P
 
but the point is I need to get rid of nan 0 0 and put some value there :(
 
yeah I know, I'm looking into that
 
thank you
 
I'm wondering how to transform the index array [1,2,3] into [1,1,2,3] etc. as a first step, to end up with an array that has duplicate rows.
make that [0,1,2] etc with zero-based indexing (facepalm)
 
I understood some of those words :(
 
12:36 PM
I can't come up with a more elegant (or numpy-ish) solution right now
inds = [ind for inds in ([i,i] if isitnan else [i] for i,isitnan in enumerate(np.isnan(gender))) for ind in inds]
In [22]: data[inds]
Out[22]:
array([[ nan,   0.,   0.],
       [ nan,   0.,   0.],
       [  1.,   1.,   1.],
       [  0.,   0.,   1.]])
all that inds does is duplicate the row indices wherever gender is nan
since you have 100 rows, this native python list comp shouldn't hit you too hard
I have to leave for a while, but what I'd do next is separate every second nan in the new array, and replace the first elements in the way you want them to be handled
you can't really spare the loop there unless you vectorize your "p" function
so either you vectorize it, or just loop over np.where(np.isnan(data[inds])) and replace each row manually
that's it for now
 
thank you
happy turkey day
 
1:00 PM
Hello there
 
 
1 hour later…
jjj
2:13 PM
hi
 
hello
 
\o cbg
 
cbg, MooingRawr. I guess all the USAians are busy giving thanks.
 
Tis be true. It's going to be a quiet one today and i suspect tomorrow too since most ppl would want a super long weekend off
 
Hi
 
2:26 PM
cbg
 
jjj
I have a pandas dataframe say 50x100. It's rather sparse (ie. mostly NaNs). Values are floats 0 to 1. Id like to scatterplot the data like this. I was hoping I could plot dots in a loop and then resize them via s parameter, but pyplot yells at me (it wont plot objects of unequal dimensions). The code I tried was:
 
one of my questions have been left answered, can I ask them here (it has been over 24 hours)
 
jjj
 for ind in df2.columns[1:]:
            tp = df2[str(ind)]
            values = tp[~tp.isnull()]
            sizes = values+(2/values)
            colors = cm.gist_rainbow_r(values)
            ax.plot(
                tp[~tp.isnull()].index,
                df2.index,
                s=sizes,
                c=colors,
                alpha=0.5)
 
@Melsauce hmmm our room rule generally states that recent questions (such as 2-3 days) is still too early for you to post. But maybe you might get some viewers on the main question :D
 
lol ok
just in case someone can help me out (if it helps, it is for a noble cause!)

https://stackoverflow.com/questions/47424751/twitter-how-to-extract-tweets-containing-symbols
 
2:32 PM
:\ not posting also extends to not linking the question :\. If people are curious about it, they would look up your profile and fine the questions (for future reference :D)
 
ok
I'll just discuss the question, then?
 
@jjj I know nothing about Pandas sorry... butafter you have resized them are you sure your frame is the same size/dimension?
 
Basically, I want to extract tweets from twitter, but the search query contains just a string of symbols (eg. '!!!'). How do I do this?
 
@Melsauce We discourage users from discussion their question if they have posted on the main site, since the answers will be split up. Meaning if someone on the main site found some details out, and the people in the chat doesn't know about it, the people in the chat might spend time trying to figure out that detail with out knowing. The best course of action, for the future, is either come here first and ask a question then post on the site if you think you didn't get a good enough response.
or to wait for a few days to blow over and post the question here from the main site (not sure if it will yield any better results).
 
ok, sure! Makes sense
 
jjj
2:37 PM
@MooingRawr Hey, thanks for asking. Well, I'm not really resizing anything. I just wanted to plot indices of columns which are not empty. The dimensions wont match. I believe there must be a easy way of doing this, but I have no idea where to even start searching.
 
I left you a comment on your question, generally design questions aren't well receive on the main site. The chat room might be better for it, however:
Nov 12 at 19:39, by davidism
We requrire you to have a basic understanding of Python, your problem, and your data, before we can help you. That's for our sanity and your long-term benefit.
@jjj well you have to match the dimension to something so maybe that would give you some hints on where your problem lies? sorry not very helpful :D
 
@jjj can't and won't open dubious image hosting links, upload it to stack imgur
 
Thanks @MooingRawr! Yes, I do have a fairy good understanding of those things :D
Also, just posting a clarification to your comment on to the main question.
And thanks again for helping out!
 
you almost certainly can plot a scatter plot with a single call to pyplot.scatter
 
jjj
Oh, ok. Sorry
 
2:41 PM
cbg AD :D
 
cbg >:|
 
something wrong ? are you feeling okie?
 
I'm pretty pissed at my neighbours in the apartment complex I live in, so don't take my enhanced grump levels personally
 
Oh, you've already told me about your grumpiness in the past, I take nothing personally when you are off :D Just wanted to see if you wanted to talk about it is all.
 
recbg
 
2:42 PM
cbg Antti
 
@jjj superficially you probably just have to index into df2[~tp.isnull()].index to have an equal number of items in the x and y components
@MooingRawr nah, thanks, it's fine
 
jjj
Here is the pic: imgur.com/a/QhuU2
 
you can just use the "upload" button right there ->
(unless you want to be able to delete it afterwards)
so it seems you have colors as a function of x categories, and size as a function of nonzero values
that looks pretty doable with a single call to scatter
 
jjj
hmm, maybe somethings wrong with my eyes, but there is no upload here.. (I mean, I cant see it)
 
Hmm. I seem to remember that it's disabled for low-rep users, but I'd have guessed that 75+ is enough :/
in that case sorry, it's not your fault :)
 
jjj
2:46 PM
Oh, ok :)
 
so I tried to vectorize my problem by which I mean I created an array. now my problem is simpler I think. I want to replace a row which looks like [NaN, a, b]] with a corresponding [x, a, b] row from my probability distribution ndarray. gist.githubusercontent.com/anonymous/…
 
> At 100 reputation you also get access to the "Upload image" button in chat.
that's pretty stupid
 
jjj
Cool, just 25 more ;)
 
It is just imgur, no?
 
Yes and no, we wouldn't want new users to spam the site of images (when images aren't always well recieve)
 
2:47 PM
@kush yes, but stack imgur, so you only need 2 button clicks and no imgur registration
@MooingRawr anyone with 20 rep can onebox off-site images
 
jjj
But Andras could you maybe suggest how should I deal with this scatterproblem? I feel really lost.
 
(you don't need to have an account on Imgur to upload to Imgur. (to your point about 20 reps) did not know that...
 
btw, is this vectorized now? (:
 
@MooingRawr oh I didn't know that
@kush I'll try to take a look later, feel free to ping me if I forget
 
all I did was put it in an ndarray
what i am hoping is some way to look at our row [NaN, a, b] and then find a corresponding [p(0), a, b] row in the table and substitute in two rows: [0*p(0), a, b], [1*{1 - p(0)), a, b]
 
2:56 PM
@jjj I'm not really sure what your x and y coordinates are
but if you want to just scatter plot with nans ignored, scatter should automatically do that for you
let me show you a dummy example
 
jjj
Yes it does. My biggest problem is how to connect all those three variabls. Hold on, I'll pase a small slice of my df.
    0   1         2
0 NaN NaN       NaN
1 NaN NaN  0.023393
2 0.32 0.5     NaN
3 NaN NaN  0.029485
4 NaN NaN  0.030936
 
I've tried to restate my problem so people don't have to look at the code:

I have an ndarray with D rows and 3 columns. some rows look like this [Nan, a, b] where a, b are either 0 or 1. I have a distribution table with [x, a, b] with each unique combination of a, b so four total rows. I need some way to look at our data row [NaN, a, b] and then find a corresponding [p(0), a, b] row in the distribution table and add two rows: [0*p(0), a, b], [1*{1 - p(0)), a, b] and remove the original data row [NaN, a, b]
 
In [61]: import pandas as pd
    ...: df = pd.DataFrame({'a':[1,2,3], 'b':[10,11,12], 'c':[-2,-3,-4]})

In [62]: df.plot.scatter(x=['a','b'],y=['c','c'])
Out[62]: <matplotlib.axes._subplots.AxesSubplot at 0x7f4b787fd668>

In [63]: import matplotlib.pyplot as plt; plt.show()
 
cbg
 
that ^^ gives you a scatter by plotting 'a' vs 'c' and 'b' vs 'c'
df.plot.scatter(x=['a','b'],y=['c','c'],s=df[['a','a']]) gives you sizes according to the a values
(there might be an ever better way, but I'm not that versed in pandas)
 
jjj
3:03 PM
hm, ok. This points me somewhere :)
 
so you can probably define s and c for your entire dataframe, and you can first ignore the nans and just call scatter; my hunch is that it will happily ignore any nan-containing values automatically
 
jjj
Thank you, I'll try that.
 
@kush good job, I believe that's a good synopsis
 
@Mirac7 cbg
 
@jjj df = pd.DataFrame({'a':[1,pd.np.nan,3], 'b':[10,11,12], 'c':[-2,-3,-4]}); df.plot.scatter('a','b') nicely gives me 2 points instead of 3, so it should probably work
 
3:12 PM
cbg
 
cbg
 
it's been a long time.
 
jjj
@AndrasDeak thanks this works, but what if I want to plot this against row number? How can I get around the dimensions not matching?
 
you can't; it only makes sense to plot (x,y) pairs when the number of x and y components is the same :P
 
3:22 PM
you need to fix your semantic error
 
cbg
 
jjj
heh
 
@AndrasDeak me?
 
no, been talking to jjj :)
 
@AndrasDeak Not really, you could plot 2 lines with 2 datapoints against a 3 datapoint y dimension.
 
3:27 PM
Good, you're free to elaborate. I'm pre-occupied.
 
@AndrasDeak Nvm, you nailed it.
 
@ReblochonMasque As I'm sure you're well aware, Contrived homework questions can be a pain...
 
 
1 hour later…
4:42 PM
Has anyone ever had any succes with pyminifier? None of the obfuscating options nor the --nolatin option work for me.
 
5:02 PM
Turkey Cabbage, everyone.
 
cbg \o
 
0/
 
How do you update the version of OpenSSL that _ssl is linked to?
 
5:18 PM
You would have to recompile the interpreter, I guess
 
5:29 PM
rb folks
 
rhubarb @AndyK
 
how do I use numpy.delete?

test_calculate_probability()
for row in data[where_are_nans]:
logging.debug(f"the weight is {row[1]}")
logging.debug(f"the height is {row[2]}")
row_index = numpy.argwhere(data == row)
logging.debug(f"About to delete data {len(data)}")
logging.debug(data)
data = numpy.delete(data, row_index)
logging.debug(f"deleted data {len(data)}")
logging.debug(data)
 
5:46 PM
don't; use logical indexing
data = data[data!=row] unless I'm mistaken
it might be more complicated if you still have 2d data, but anyway indexing should be the right way
what are you trying to do exactly?
also read the second pinned post to see how code formatting works in chat ->
 
00:00 - 18:0018:00 - 00:00

« first day (2595 days earlier)      last day (2361 days later) »