« first day (3639 days earlier)      last day (1534 days later) » 

03:47
hi
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
what's the error? @KokHyvv
it's says
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
  print(df).
is that period in your code? if so it should be removed
delete print(df) ? so how i can print data ?
no, the period after it
  print(df).
 --------- ^
03:59
i have delete . it's show this error
is that in your code?
if sum(df[col].isnull())/float(len(df.index)) > : del df[col]
^
SyntaxError: invalid syntax
yes i want get data from my csv file and show row
what happened to your 0.8?
it show error with this ':'
sorry my mistake
this is my code :
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
great, we've solved one error
04:04
yeah , and 2nd error how we can fix it
i just don't understand what is the porblem in line 8 in if
04:26
any help guys
05:13
the traceback looks truncated, I'm guessing col or maybe df is not what you assume it is
can you add a line which simply prints df[col] and see if that crashes too?
anyway, not a Pandas person, but isn't col already a row from df, not an index into it?
@KokHyvv ^
 
1 hour later…
06:18
@tripleee indeed
06:39
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
unclear why it's popular really, but it is
maybe also look at github.com/trending/python
from those, github.com/geekcomputers/Python looks similar
06:56
Digital Ocean just need to kill the event forever
points to el Reg for the wording in their cookie pop-up
07:22
@metatoaster because if the noise?
I quite enjoyed it last time, and was hoping to participate this year again
Yeah, the spam burden seems to be insane this year. I guess the event has reached a critical mass in popularity.
just found twitter.com/shitoberfest this morning to laugh/cry at some of the submissions
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.
07:39
In an ideal world it would be a great initiative, but we've been living in the dark timeline since the real world ended in 2012.
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"
07:57
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.
 
2 hours later…
09:34
@tripleee i have removed if line and work fine ,, but i want show data if value is > 0.8 how to do that
like I said I'm not a Pandas person, but it should not be hard to find working examples
10:34
hi
in tkinter module , is window a real thing in it?
@SandrinJoy what do you mean?
like frame , button , and other stuff
Sorry, that didn't make your question any clearer
to initialise a tkinter GUI , we write a =tk()
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.
does that help?
10:43
i have read this. but my professor is telling that window is a thing in tkinter
when i gone through the tkinter docs, there is no mention about window
there's probably a lot of noise in the communication here to figure out what's really going on
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

Correct answers
12
[11, 12, 43] 12
[11, 12, 43], 12
he gave no marks , because i mentioned output explicitly
look at this question too.
Ah yes, programming exams. Always a joy.
@SandrinJoy if you write cruft like output[0] in a quiz that is clearly graded automatically you have mostly yourself to blame
10:58
but it really depressing. when u get no marks for the correct answers
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
unless it prints something like output[0]: ... ;)
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
but he asked string or item
So? Both lists and strings can contain strings
The question is how you find the index of a string or item, not in a string
11:20
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
@AndrasDeak @Aran-Fey Thanks a lot
good luck
Is there a way to make this work? python -c "import glob, os; for i in [1,2,3]: print(i)"
11:41
u mean , to get the output in the cmd?
@SandrinJoy for it not to raise a syntax error
yes I just want to run that one liner from the command prompt
he left spaces after semicolon, maybe thats why he get errors
naw son, removing the space after the ; still throws an error
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
oh, my solution is the solution, nice
11:47
rejoice!
thanks Andras
I guess with -c one can:
python -c "exec('import glob, os\nfor i in [1,2,3]: print(i)')"
that's kind of hoodrat tho
exec is another function ig
you can keep the string at the end of the line with <(), probably
python <(echo -e 'import glob, os\nfor i in [1,2,3]: print(i)')
but that probably needs more resources than a direct pipe
ah interesting
and I don't know how bash-specific that syntax is
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
11:56
note that interactively you can just type newlines in strings
$ python -c 'import glob, os
> for i in [1, 2, 3]:
>     print(i)'
1
2
3
 
2 hours later…
13:33
morning cabbages, folks
14:19
Does anyone know why the requested module cannot be found? I've pip installed it and the error still appears
Hmm, odd
Are you sure about capitalisation?
The import statement appears to match the prescribed syntax, capitalization-wise
This is a mess. PyPI has Flask-Cors, package name is flask-cors, import has flask_cors (OK, no hyphen allowed there), docs has Flask-CORS
Yep :-)
14:25
@John all that's left is "have you tried turning it off and on again?"
@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
To be fair, I never know how to deal with acronyms in my code either. Sometimes I do all caps, sometimes I don't
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.
@Aran-Fey I could go with anything, it's the mixture of cases that bothers me a bit
^^^ I, too, hate acronyms in variable names
No droids here, move along :-)
Pro style tip: for maximum clarity, separate letters of your acronym with underscores, for example u_r_l = "example.com" :^)
14:29
Or go the extra mile and stack a couple of namespaces: u.r.l = ...
Or avoid acronyms entirely: uniform_resource_locator = "hyper_text_transfer_protocol://world_wide_web.example.computer"
wait, .com is short for "computer"? I had no idea
commercial
It isn't, but I couldn't be bothered to fact check
Let's say that my being dumb was an additional layer to the joke. Yeah, that's it.
I think I'd prefer "computer" tbh
14:36
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.
.org generally refers to non-profit organization as defined by USians
You can do things like kevin.script or kevinscript.lang nowadays
the proliferation of gTLD unleashed that, yes
Eleven countries whose TLD starts with k, and none of them have the decency to be .ks >:-(
Et tu, South Korea?
Just another reason to declare my house a sovereign nation
14:58
.us? Too vanilla
kevinscript.a-language-for-the-rest-of.us
I do not speak that dialect
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
15:06
Thank you for sharing your culture with me
I'm sure you could get a .kevin gTLD pushed through pretty easily
Someday Andras 2.0 will be released, which will be able to process not only text but also images
Here is a characteristic example. Notice also the casual implication of severe depression, which is quite popular among millennial and younger memecrafters
good grief, this just showed up in some example code:
   if len(dic[k]) > mxlen:
       mxlen = len(dic[k])
I wonder how often people come up with a very clever url but then discover that the TLD required belongs to a disliked country
15:14
sorry, too juvenile for here?
typical beginner code, I'd say
It is fortunate that North Korea's TLD isn't .nk or else there'd be a lot of frustrated webmasters
@MattDMo I chuckled.
Can't say I approve of mxlen though
@MattDMo I genuinely didn't get your issue...
And of course you almost never need to write a multiline max-finding loop when max() exists and accepts a comprehension
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
15:20
I dig the sample-and-zip idea conceptually but there's too much type conversion etc going on for it to be aesthetically pleasant in practice
    for i in range(mq.shape[0]):
I feel dirty ^
Devs, please implement random.shuffled(iterable_with_finite_length) -> list, thanks in advance
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())}
Much clearer!
15:28
Is dict(input_dict) somehow exempt? :)
I guess no, since even dict(input_dict.items()) would be shorter, so it's just for comedic effect
I'll have to ask The Council what dict(the_dict) should do.
Well, you have to separate the keys and values at some point in order to shuffle them independently
(The Council is me, me, me, me, and me)
@Aran-Fey good point
no, wait, the dict comp would be the same
Ah, no, because obviously d.keys() itself would shuffle
yeah
15:30
The KevinScript steering committee
looks very competent
Our motto is "move fast and break things". Not for the purpose of making a superior product, just for the joy of it
That's fine as long as you don't drive cars with the same mindset
Only my adultsona (not pictured above) is allowed to operate heavy machinery
15:49
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
16:01
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"
16:15
Knowing wikipedia, I bet the information is correct, but presented in a way that only experts can interpret correctly
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:
16:45
> 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.
So sounds like exactly what you wrote
I demand that same sentence but with more sciencey syntax
Plus signs and arrows mandatory
The figure caption says "SiC or graphite". And the reactions relate to "production of SiC".
Paradoxically you can't make graphite unless you already have a graphite rod to pass heat through. Very chicken-and-egg.
@Kevin actually, seems you only need coke
Basically crystallizes carbon through an intermediary
First Hungarian google hit has to do with graphite. Says SiC breaks down above 4150 EU degrees
maybe I'm misreading it and the graphite spontaneously forms into a rod shape, and you don't need to have one already made.
16:51
@Kevin no, that's what the figure says, but I suspect that's geared at SiC production
There's also something cryptic later in the text
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
silicon rods need not apply
> 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
I bet it's one of those quantum wossnames
17:17
@Kevin crystallization is tricky. Diamond is very stable once formed. But it needs huge pressure and long time.
like wanting to pump energy into a room to make it cool faster. That's not how it works. (And no, leave air conditioning out of this :P)
I guess you can't expect things to neatly roll down the energy gradient when there's 1.21 JiggaJoules hanging around
@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
Oh, I heard about that in the context of an HIV medication
That's some Ice-Nine scifi stuff right there
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
Maybe Edward Goodrich Acheson got cancelled on twitter and they renamed the process
17:32
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
Which, y'know, fair
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
Relatable, give or take the tech stack involved
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
17:50
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
18:04
@roganjosh sounds like an extreme case of tin pest
> 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.
Happy ending: they switched to a gel style pill*, which prevents conversion
(*Or possibly a pill bottle with a gel-like seal? idk)
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.
18:19
For morning sickness
Huh, it turns out you can actually use polymorphism to extend exclusivity
They didn't separate the two chiral kinds but even if they had, they convert back and forth in the body
@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 :)
 
1 hour later…
19:44
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
Weird, I'm pretty sure I always get canonical URLs
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
@roganjosh at worst you can use the API. I used that to find pythoff answers of mine
I think a heuristic would probably be broken, it might just be better to try pull every answer with a github link with a line number
19:57
there's a grab_all_answers.py that uses the API
Neat, thanks!
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
Haha, I'll vet it first :P It won't even need regex, '#L' is probably enough for me to not pull any false positives. Win.
I meant the query filter that encodes what you want to get back. I would vouch for my own regexen :P
Oh, that wasn't a criticism of your regex, only that a) I have an near-indomitable aversion to regex and b) my target is easier to find :P
20:10
regex is fine when used appropriately
r'\b(print|xrange) ' only picks up xrange if it's followed by a space, that's not intended, is it?
It's only a case that I've never had a need to use it and it looks sufficiently complicated (if you don't know it) to make me not want to use it
Serious question, though. What does that regex buy over 'xrange' in string?
@Aran-Fey hehe
so much for vouching for my regexen
regex won't be tripped up by my_xrange or something similar
@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...
20:18
@Aran-Fey fair. I think my glasses are too tinted by the fact I started with pythoff and xrange in a name just wouldn't occur to me
Although, that justification is nonsense because I would use sum in a name. My brain just weasels its way out of needing regex :P
I'm pretty sure I searched for xrange using SO's internal filter anyway...
son of a yam, I still have 3 xrange-y answers D:
I'll go hide in a cave. Thanks for the spot, @Aran-Fey
No problem. Pointing out other people's mistakes is what I live for :P
 
2 hours later…
22:21
I rearranged my schedule, hid from my bosses, and I've done it! I'm free for the meet tomorrow!

« first day (3639 days earlier)      last day (1534 days later) »