How to read the nan value using if condition in pandas? I have a data frame which has a column name called "Rating". It has "Nan" values. I am tryting to read using this code (bpaste.net/AMTC5AGL6WAW65WW4TM7UTPNGI) but not successful. I am getting error message : "The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()"
my issue with the 2nd half in for else block has been that unless you explicitly know beforehand that it's relying on a break inside the loop, then the syntax does nothing to make that relation clear
So, that's how im approaching it. so, even then wouldn't quite do it
It would be better than accidentally writing a for else loop due to indentation issues though i suppose. so that would be something. But still feels like a compromise
Is there something else that makes that relation with break clearer but is better than no-break ?
I don't really mind the else not being self-documenting, tbh. Things like continue, break, yield, def aren't exactly self-documenting either and nobody minds those
The one difference i see between all of them vs here is they all can only be used in one specific place, the keyword is not "overloaded" in that sense.
Although I have to admit that the else on loops probably makes a lot of people think "What the heck is that else doing there, is that a syntax error?" rather than "huh, I've never seen this control flow keyword before"
try/if would be ambiguous though (think of wanting to put a conditional block after a handling block)
the loop else block is pretty obscure, i'm sort of surprised that guido wouldn't have just said "set a flag before breaking" and eschew that feature in the first place
this is so weird... German research conferencing is totally overloaded since everyone and their cat is on WFH now... we're recycling virtual meeting rooms now oO
"thanks for connecting, please leave now because we need this room for the next meeting"
@JonClements you just saved me a lot of time with this tip! Didn't know about breakpoints yesterday, but somehow remembered reading this message when i needed something precisely like that! ^.^
I mean, to be fair, just for context, there's people who haven't even touched computers when they start doing B.Tech. I know a couple people who were like that. There really is no need to look down at people if they're actively trying to fix the gaps in their knowledge, even if it's for the simple things we take for granted.
that's one of the reasons it is hard actually. It's a setting inside the BIOS, which usually has no easy way to be changed, unless you know what you're doing (or the keyboard explicitly provides a toggle), either way, it's not standard.
off the topic(again) if you have already released an app and someone asked for the code for a feature that might be useful to him too would you give it?. (depends on what?)
yeah... depends... I probably would... but it depends what plans you have for it... have you got an idea for any sort of licence for the code? eg: did you intend to make it open source at some point or...?
Most of my personal projects are open source so it's a moot point. He can go get the code from github if he so desires
In the rare situation where the project isn't open source, I probably have a good reason, which is unlikely to be overturned by the request of one internet rando
Maybe the code is horribly ugly and I'm embarrassed to have written it. Maybe it's a heartbreaking work of staggering genius and I want to keep it all for myself
The principle applies even on SO. If I had a nickel for every SO question I answered and then ghosted on after the OP asked for three more things in the comments...
i kinda like that about human advancement as a whole. while we may attribute innovations and breakthroughs to specific individuals (and fairly so as well), a lot of groundwork is laid out as a collective effort of people before them
There's a theory that most inventions and discoveries do not require a supergenius to discover them, and the only reason that calculus wasn't invented a hundred years earlier is because it depends on a number of concepts that were not there a hundred years earlier
Another example: darwin had a number of contemporaries that were kicking around the idea of something like evolution, so it's unlikely we would have remained totally clueless about the principle if he had decided to become a priest instead
@Xfce4 possibly but you'd need to be more specific and it'd probably help if what you're after is somehow Python related given this is Python room and all that...
@Kevin had a bit of luck with a thassa and agent of treachery setup yesterday... needs a heck of work but might be possible to make something more than decent out of it
Would it be a practical/desirable exercise to split the Python books from the non-Python in sopython.com/wiki/Recommended_Reading to help those who are specifically looking for a physical book from which to learn Python?
I'm asking because I'm trying to answer a webmaster question.
I'm quite fond of Agent of Treachery but i can imagine some challenging matchups where taking one of your opponent's permanents per turn will not stop them from defeating you. White weenie and burn, for example. So the principal deckbuilding challenge is, what to do about those sorts of opponents
Ah, I did n't recognise the irony in the rubric, and didn't scan it for Python books. So it's me that was confused, and that was where your confusion came from.
@Xfce4 this is the right place for asking for help with python problems. You can look around on chat.stackexchange.net for broader design problems. I'm thinking Server Fault and friends might be relevant if you don't have a programming problem yet.
@Kevin mono-red aggro is still popular... you can churn out massive amounts of 1-1's (a lot with haste/riot), and with a couple of Cavalcade of Calamity - it's err... painful
@Xfce4 Of course it's possible, there's one in the stdlib, as I said earlier. However, it is not a secure server, suitable for production use on the open Internet. And I wouldn't advise anyone to attempt to make such a thing in Python. Creating secure servers isn't easy, and it's a job that requires a lot of expertise.
But why would you even want to write a server anyway? Just use an existing server. So your real problem is to find a suitable hosting service that you can afford.
@PM2Ring YEah security is my concern too. I want to write the server so that I can keep the system requirements at minimum. I don't want to spend too much money on server part yet.
@PM2Ring Also I am not sure if a server I hire will be enough for the task. I tried to ask questions in ServerFault and SUperUser but all of my questions were closed.
@Xfce4 The Apache server is free, and 2/3 of the servers on the Web are Apache. But to handle around a thousand users you are most likely going to have to pay for hosting.
Apache played a key role in the initial growth of the World Wide Web, quickly overtaking NCSA HTTPd as the dominant HTTP server, and has remained most popular since April 1996. In 2009, it became the first web server software to serve more than 100 million websites. As of February 2020, it was estimated to serve 24.51% of all active websites, ranked 2nd after Nginx at 36.48%, while according W3Techs, Apache is ranked first at 40.4% and Nginx 2nd at 31.8%.
I think you guys have been talking about 2 different things re: servers. It looks to me like Xfce4 is referring to a host e.g. digitalocean rather than a server hosting an application
When I used to have to suffer from doing VB... don't know if it's still the case... but to return a value you had to do something crazy like have the last line assign a value to the name of the function?
historically MATLAB started out as a thin wrapper for LAPACK/BLAS linalg functions written in fortran which have a terrible API. This was in the '60s or maybe '70s. It grew out to be a huge commercial package for all sorts of scientific computations and simulations, including visualization.
python blew up, pulling in broader community and a need for scientific programming, so things like numeric -> numpy started supporting MATLAB's functionality, and matplotlib for plotting (hence the "mat" in matplotlib)
@αԋɱҽԃαмєяιcαη The code itself looks syntactically correct. Most likely the problem is that m.group(1) returns a string that is not a valid Python literal
If you're more interested in getting the code working than solving the mystery of why it's broken, you could simply replace the assignment expression with a regular assignment statement followed by a regular conditional
m = re.search(pattern, script.text, re.M | re.S)
if m:
#...
Half-baked theory: the IDE has a built-in style enforcer, and assumes that any line starting with if m: <whatever> should be converted to if m: <newline><tab><whatever>, and is "helpfully" doing this to if m:= whatever:, not recognizing that the result is gibberish
I suspect the idea of a "multidict" has been kicked around the dev mailing list quite a bit over the years, but it's not quite useful/elegant/distinct-from-existing-types enough to merit explicit inclusion
Re: VB/Pascal. I see the appeal of assignment-as-return from the standpoint of parser design. The fewer unique statements your language has, the easier it is to implement.
... Not that return <expr> is all that hard to implement, even for a simple recursive descent parser. Perhaps things are a little trickier if you want to allow both return and return <expr>
@Manik scanning QR codes with a camera is just so much of a faff though - apart from having a nice little easily scannable area so you don't have to bother typing in a web address - I've not seen the point of 'em
took me a good two/three minutes the other day to link my device to continue using the whatsapp web app...
enable the camera, hold it at right position, meh, that's not working, move back a bit, move forward a bit, try and get everything in line with the square and then, no, timeout, do it all again... etc...
@AndrasDeak Maybe? But I haven't written any Fortran since the late 70s, so my memories of its syntax are very hazy... and kind of mixed up with the 20 or so dialects of Basic that I used back in Ancient Times. :)
@Manik It rarely suggests anything useful, and sometimes autocompletes complete garbage. One time I was writing an __init__ method and it suddenly had 5 random parameters but no self
@Manik please pick up the pace and stop talking about that subject, as you have been told by other room owners. If you need an explicit official request, this is it.
@Aran-Fey since one of the few advantages of IDEs is hinting like that, I'd also be annoyed if it wasn't working properly. Might as well just use a good editor instead (I know, there are other stuff like debugging, git integration etc.)