import pandas as pd
import numpy as np
df = pd.read_csv('reg_pbp_2009.csv', low_memory=False)
df = pd.DataFrame(df)
for col in df.iterrows():
if sum(df[col].isnull())/float(len(df.index)) > 0.8: del df[col]
print(df).
what is the error in my code
it's says error in line 7 that's mean in if statement
File "C:\Users\umnia\Desktop\test.py", line 8, in <module> if sum(df[col].isnull())/float(len(df.index)) > 0.8: del df[col] File "C:\Users\umnia\anaconda3\lib\site-packages\pandas\core\frame.py", line 2800, in __getitem__ indexer = self.columns.get_loc(key) File "C:\Users\umnia\anaconda3\lib\site-packages\pandas\core\indexes\base.py", line 2646, in get_loc return self._engine.get_loc(key) File "pandas\_libs\index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc File "pandas\_libs\index.pyx", line 116, in pandas._libs.index.IndexEngine.get_loc
import pandas as pd
import numpy as np
df = pd.read_csv('reg_pbp_2009.csv', low_memory=False)
df = pd.DataFrame(df)
for col in df.iterrows():
if sum(df[col].isnull())/float(len(df.index)) > 0.8: del df[col]
print(df)
and this is the error
File "C:\Users\umnia\Desktop\test.py", line 8, in <module>
if sum(df[col].isnull())/float(len(df.index)) > 0.8: del df[col]
Name: 0, Length: 256, dtype: object)' is an invalid key
I did some Preptember work a few weeks ago to find popular Python projects on GitHub with bugs in them. So far my first three Hacktoberfest PRs were quickly approved in github.com/Python-World but there is probably a lot more to do there
The issue is that Digital Ocean thinks they are helping but they are just literally exploiting maintainers of open source projects to curate submissions for their T-shirt contest, while flatly lying to everyone including themselves to think they are helping, somehow. If they really want to help Open Source they should just send maintainers money.
I still think that only PRs towards issues that have been tagged with hacktober should count towards completion. then the cruft would be easier to sort out by november, and projects that aren't interested in participating aren't dragged into this. maintainer time is occupied anyways, so at least give them some tools to guide the "help"
There's also the issue of lack of consent from the maintainers of the projects to opt into the contest that Digital Ocean started, but instead they unilaterally imposed this upon every maintainer on this planet with no due process.
class Tk(Misc, Wm)
| Tk(screenName=None, baseName=None, className='Tk', useTk=1, sync=0, use=None)
|
| Toplevel widget of Tk which represents mostly the main window
| of an application. It has an associated Tcl interpreter.
nvm. i got really less marks in a python mcq test. some questions didn't had any logic atall
What will be the output for the following question? >>L=[11, 12, 43] >>print(L) >>S=['@', '#', (1,2), L] >>print(S[3][1]) * my answer :output[0]:[11, 12, 43] output[1]:12
if those >> characters are really there it's partly the prof's fault for mixing REPL-like syntax in there, but I'll note that output[0] is neither vanilla REPL output nor ipython/jupyter
but yeah, the screenshot you posted doesn't impress me
not sure what the point is in a programming quiz where you can just run the code and see what it prints
for the screenshot i posted , what is your opinion?
[4:30 PM, 10/2/2020] Prabu Sir Christ Uni: qn is not only for string it is for items in other datatypes [4:31 PM, 10/2/2020] Prabu Sir Christ Uni: list_name.index(element, start, end) [4:31 PM, 10/2/2020] Prabu Sir Christ Uni: list.index()
this is what the explanation he gave me , when i asked the doubt
It's an awful question. It's unclear if list and string are supposed to refer to the class or if they're supposed to be instances of the class. Depending on how you interpret the question, both list.index and string.index can be correct answers. (Technically, char.index as well, although that doesn't make sense semantically)
That said, list.index is definitely the safest choice
finally friends , i feel so satisfied . Sir just called me & lucky that with all of your valid opinions i said & he is now ready to recheck and provide marks
I never got the hang of that. The only thing I know works is echo -e 'import glob, os\nfor i in [1,2,3]: print(i)' | python but there's definitely a way with -c
I'm also certain there's a question or two about that on main
it's all good, I never use this -c syntax but it's nice once in a while so you don't have to bother with a file in some Docker-like sequence of commands
@John have you pip-installed anything else recently? If you can import other third party libraries properly, then it's probably a problem with Flask-CORS. If you can't import other third party libraries, it's probably a problem with pip or some other part of your dev environment
For maximum verification you could install something right now, in exactly the way you installed flask-CORS, and see whether you can import it. I nominate toolz because the z makes it extra cool.
I was going to say "it's pretty cynical that the most popular TLD by a wide margin is the one that indicates the site exists for the purpose of making a profit", but then I reflected on it and it's basically correct, and now I'm sad
What TLD should I use for KevinScript's website... It's not .com because it's not commercial. I can't use .org because it's not organized by any reasonable definition. What a pickle.
This is the second frame of a meme where a woman initially discards some option as undesirable, and then discovers another option which is surprisingly good
Similar to the disapproving drake meme, but with greater undertones of spontaneity
Here is a characteristic example. Notice also the casual implication of severe depression, which is quite popular among millennial and younger memecrafters
I've recently had a discussion with someone who said the code dict(zip(random.sample(list(my_dict.keys()), len(my_dict)), my_dict.values()), was better than the corresponding 3-liner with random.shuffle, so code of this caliber cannot faze me right now
I don't suppose anyone knows a way of determining the parameter values for werkzeug.ProxyFix? At first I thought the values were an upper limit but looking in the code it seems it expects exact values so I'll be here all night guessing combos :/
Simply use KPython, which intentionally shuffles the iteration order of a dict at all possible opportunities. Then the solution is just {k: v for k,v in zip(d.keys(), d.values())}
Hmm, it bothers me that en.wikipedia.org/wiki/Acheson_process says the process synthesizes silicon carbide (SiC) and graphite (C), but there are precisely zero instances of C by itself on the right hand side of any of the reactions listed
If anything, this looks like a process for getting rid of C
Maybe the graphite synthesizing part is a separate process that happens when you apply even more heat to the furnace, and they didn't write down the formula because they were embarassed to admit they didn't know what happens to the Si
"SiC + 1.21 JiggaJoules -> C + uhhh silicon vapor? That's a thing right"
Can't get sued by your metalworks laborers for giving them silica lung if you pretend the silicon magically disappears instead of becoming a vapor :guy tapping head meme:
> In 1890 Acheson attempted to synthesize diamond but ended up creating blue crystals of silicon carbide that he called carborundum.[4] He found that the silicon vaporized when overheated, leaving graphite.
And/or graphite rods are convenient heating elements for this but aren't strictly necessary and you can use any old rod lying around as long as it can withstand 4000 C
> He also discovered that when starting with carbon instead of silicon carbide, graphite was produced only when there was an impurity, such as silica, that would result in first producing a carbide.
@Kevin I guess you'd want graphite because it conducts
Really I just want to make pencil lead in my front yard
Sounds like you can't just do "C (coke) + 1.21 JiggaJoules -> C (graphite)", you need Si as an intermediary or else it won't precipitate properly or whatever
Which seems counter-intuitive to me. Coke burns and graphite doesn't, so you'd think the C would be happy to traipse down the energy gradient to the more stable configuration
@AndrasDeak reminds me that there have been pharmaceutical companies rendered unable to created their own patented polymorphs of drugs potentially forevermore. That has to sting
Once a bad seed is encountered, the whole batch is ruined. Then the bad seeds get out into the atmosphere and you're stuffed
Alas, Kevin, I went and dug out my copy of the Chemical Engineering Handbook and it appears not to mention the Acheson Process (or I've just forgotten how to use the Index properly, which is quite possible)
IIRC the PDF version was 4,700 pages long. It's hard to tell from the physical copy because of the way it's subdivided
Ah, the 7th Edition is directly online if you just search for Perry's Chemical Engineers' Handbook. Only ~2,600 pages. I must have misremembered because I can't see how they'd have added that much in the 8th edition
Nothing obviously problematic in his Wikipedia biography, although I'm sure there are plenty of people that would cancel every white man from the 1800s on principle
After a long battle, turned out I could get everything I needed for ProxyFix just by printing out request.headers :/ That was several hours of wasted guesswork... and it still doesn't work. I guess the systems guys need to change something in Nginx. I'm >....< this close to being able to deploy full flask dashboards at work but it was not to be to end a busy week
The bright side of leaving something >...< this close to done on a Friday afternoon is, when you come in on Monday you'll have a clear goal for the day, even if you're addled with weekend-itis
Goal: harass the systems guys. With a bullhorn, if it looks like they're hungover
The problem that I have is that the main motivation is that R is driving me loopy and the last stage of the onboarding process is to build a dashboard in Shiny. Just looking at the code hurts my brain. Why would you allow . in variable names only to then have to use %>% to chain operations?
So there's a chance it'll be put on low priority because technically they already have the dashboarding functionality
Ah well, I am still gonna learn it. Confusion isn't exactly a good excuse to be lazy :P
> As a consequence of the fact that even a trace amount of form II can result in the conversion of the more bioavailable form I into form II, the presence of form II threatened the ruin of existing supplies of the oral capsule formulation of ritonavir; and indeed, form II was found in production lines, effectively halting ritonavir production.
I think in the case of most polymorphs it isn't quite so extreme, but since you can patent on the polymorph form, I suppose it would be possible to accidentally and uncontrollably start producing a competitor's drug :P
The spookiest drug conversion I know is Thalidomide, originally given to pregnant women for nausea relief I think?
> Thalidomide is provided as a racemic mixture of two enantiomers; while there are reports that only one of the enantiomers may cause birth defects, the body converts each enantiomer into the other through mechanisms that are not well understood.
@AndrasDeak IIRC cis- and trans-platin are similar
Ah, that second example isn't as bad. cis- works and trans- does nothing
Although, it's perhaps fortunate that they discovered that cis-platin has terrible side-effects for all the good it does. But they would have known that straight away because they wouldn't have been administering trans-platin (unconscious of the fact that a stereoisomer existed) because it doesn't do anything :)
I've just realised that one of my answers tracing code paths is now utterly broken with links to github. I can't believe I've only just learned about canonical URLs. I naively assumed that's what would happen naturally. I wonder how many broken answers I have? :'(
I don't know how what I imagined would work, but the naivety was blissful
Pro-tip: if you ever plan on redirecting sys.stdout (to a StringIO or something), never default a keyword arg for a method's output to sys.stdout. Just wasted an hour not understanding why my tree() method was not sending its output to our custom logger correctly. Of course, the answer is "default the arg to None, and then in the body of the method, do if output is None: output = sys.stdout.
@AndrasDeak odd, I guess there must be a setting somewhere you may have set ages ago and you're viewing them logged-in. I'm wondering whether it'll be possible to write a heuristic script to try find all potential breakages in my answers
you can fiddle around with the filter (you can construct it interactively at api.stackexchange.com), the one I had queried answer ID, question ID and post body I think
and caveat: I don't know web stuff so handle with care :D
@roganjosh I had my reasons, but I'll have to think what they were. Aran's note is on point, that was a mistake. I must have added xrange as an afterthought
I think I planned to add several other suspects for pythoff, but then I ran out of suspects after 2. I had fairly few answers with python 2, and almost all (if not all) of them just had print statements...