« first day (3064 days earlier)      last day (2108 days later) » 
00:00 - 19:0019:00 - 00:00

00:18
Some people use box-plots to show that kind of 25-50-75 percentile data. And it looks like matplotlib has a builtin method to make them: matplotlib.org/api/_as_gen/matplotlib.pyplot.boxplot.html
Also, if you use a format that is more widely recognized, your audience will be more likely to be already familiar with it.
@wim That these discrete, minimal, isolatable components happen to be implemented via the same methodology (generators and reentrant iteration) and formerly relied on StopIteration as a mechanism to bubble for loop iteration termination up multiple stack frames (which was highly effective)… is mildly beside the point, no? Is having several for loops un-DRY? We could go full-lisp and write a foreach function… I'm totally open to PRs to "de-duplicate", though. ;^P (Never go full-lisp.)
Not much you can do to preemptively account for the language pulling out the rug from under how you're using it. XP
00:44
@amcgregor hey, I just noticed this
> It's also a Hungarian noun representing the posessive third-person singular form of "cin", meaning "tin". The "c" makes a "sh" sound, the "j" makes a "jy" sound almost like the "is" in "vision".
Hungarian "c" == /ts/
just like German, probably (I don't speak German)
unless "'sh' sound" refers to Lojban "sh" but that would be weird for them to name the sound :P
I find the j thing weird as well...
@AndrasDeak Right; unclear phrasing. I'm referring to the pronunciation as used in cinje, not referring to the Hungarian pronunciation.
yeah, that would need clarification :)
then the only thing I don't understand is 'a "jy" sound almost like the "is" in "vision"' :D Got any IPA?
Lojban gismu (root words) are actually constructed from the top 5 or so most spoken languages world-wide, which I find neat. (And oddly familiar for many words, e.g. mother = mamta.)
English doesn't really have a direct equivalent for the j. This has a good recording of the alphabet being spoken. — it's sorta dj, sorta jy…
I bet it's a Hungarian gy
(softened Russian d)
I'll have to take your word on that. XD
00:54
hmm, no, it's closer to zs, apparently
ж is lying to you, it's not a VPF. ;P
ah, no, it's actually zs; I was looking at the wrong thing
@amcgregor how so?
bah, too fancy
XD Another thing English doesn't really have, at all, in this case.
00:56
I 100% pronounce it as zs (/ʒ/)
my Hungarian Russian teacher never complained...
so it's pronounced as "sinzse", give or take the vowels :P
Dot. Dot. Dot.
Russian romanization never made any g-damn sense to me. XD I think it's a pathological regex case, like parsing HTML with regex. >_<
Indeed.
It's guaranteed to be a mess when you're trying to map to a non-phonetic language that's missing the sounds
At least I tend to think that romanization is English-centric. Might be wrong.
01:15
Japanese has it easy by comparison. ;P
a e i o u, then a straight table of consonant + vowel combinations. ka ke ki ko ku, …
01:26
And, of course, being a natural language, it has outliers: wa, o-, n. Because why not. ^_^
rhubarb
02:07
Hi
I want to write a web server with python where there is a text box and a user inputs something and I run a python function on it which gives me an output for the users input and render it on the same page, essentially like a chat with a computer
How can I go about doing this with BaseHTTPRequestHandler and HTTPServer
Anyone have any ideas?
 
6 hours later…
07:48
cbg
08:10
I have treeList[] ,which contain root of the each tree, let say i have 3 trees in treeList,basically treeList is forest of 3 trees


I have dataPointsForEachTree[] list ,which contain data points corresponds to one tree of treeList[] (one to one mapping) and those data points are not used while constructing respective tree from treeList.

Now, i have to use each datapoints for testing with respect one tree from treeList[] and get the error.
i will do it for all 3 trees and get the avg error,does it mean out of bag error ?
44
Q: What is out of bag error in Random Forests?

csaliveWhat is out of bag error in Random Forests? Is it the optimal parameter for finding the right number of trees in a Random Forest?

@sunil What, no "Hello", or "How are you guys?"?
Well, this is a QnA site, not a social networking one...
@johnsmith theres nothing wrong with that per se. sometimes, its much easier to just get to the point, rather than waste time with "i had a question, could someone help me?"
@johnsmith can you please explain more
?
I'm just messing (sarcasm is hard to show through text), i'm actually work on it now.
08:20
ohh i am sorry @johnsmith now i got what do you mean
hi all ppl out there
@sunil XD sunil i was joking, you're good.
@sunil I'm not understanding, what's wrong with the answer given in the linked question by manoj?
nvm i see what you're saying
nothing wrong i feel so ,but i have coded a random forest and i have to calculate out of bag error ,i am working on above logic and I am asking does it is correct ?
also you can check sklearn doc
Sam
Sam
08:50
Any Visual Studio Code users here? I've changed my Python interpreter using Python: Select interpreter command and restarted my integrated terminal (setting to Anaconda).. but if I then print sys.version it's still pointing to the default Python install on Mac (2.7)
Upon starting the terminal, I get this, which is confusing because i assume the first two executable commands are selecting Anaconda's env
(base) ITs-MacBook-Pro:graph_ingestion Sam$ source /Users/Sam/anaconda3/bin/activate
(base) ITs-MacBook-Pro:graph_ingestion Sam$ conda activate base
(base) ITs-MacBook-Pro:graph_ingestion Sam$ python
Python 2.7.10 (default, Aug 17 2018, 19:45:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Note that this is only the case inside VSCode's integrated terminal.. If I run the same command in Mac's terminal, I get the correct Python (Anaconda Base)
09:05
aaaaaargh yamming mobile piece of yam
1: Can the old env already be active? You have (base) already on line 1. 2: I don't think existing envs can have their interpreter replaced
Sam
Sam
I'm trying to determine if vscode does any setup prior.. reading the docs now
According the docs
> The extension automatically looks for interpreters in the following locations: Standard install paths such as /usr/local/bin, /usr/sbin, /sbin, c:\\python27, c:\\python36, etc.
But, in settings.json I've overridden this by specifying python.pythonPath
@AndrasDeak How can I check for this?
i don't know vscode's integrated terminal, but from my personal experience with pycharm's I'd advice not to expect it to be sane or fixable.
Sam
Sam
@Arne I've had them in sync in pycharm in the past. It seems like a very useful thing to have in sync.
absolutely
but if something doesn't work in pycharm's terminal, I just open up a regular one
@Sam no idea
Sam
Sam
09:18
Will carry on reading. There must be a way. Otherwise I'm revolting against MS
About time
You probably just have to turn it off and on again and update.
Sam
Sam
@AndrasDeak Good shout. Always works
Sam
Sam
09:30
Screw it i'll just have another terminal open. But let it be known i'm not happy
09:47
cbg
cbg
I stepped on a bug in the office :( It's been living here for months, I didn't see that it was sitting under my chair. Never would've noticed if it weren't for the bug smell. Poor thing. Debugging isn't always good...
Luckily, bugs are r strategists.
Well yeah, nobody's going to miss it and anyone in agriculture would want to pitchfork me for not killing it in the first place :P Still, I don't like killing things by accident. And killing innocent things, usually.
An unfortunate even for sure, but from a population's point of view, hopefully no hard was done.
10:03
nah, this fellow would've died in the office due to old age anyway
Or no food. They're usually seed happy.
yeah, true
so it may have been a mercy :P
10:24
cbg
I attempted to deal with some data, which I've already put it in the pandas.DataFrame. but i want someone can download my data as excel format, I know I can save it on somewhere once someone click the download button, and then read it as stream and pop out as
@FrankAK Cbg. I'm not sure I understand completely. Could you please try rephrasing, using a few more complete sentences?
Yeah, I'm at a loss as well.
Not sure of the workflow or the technology used to process and deliver those excel files.
also, why excel? why not, say, a csv?
Some people are hellbent on tools they know - and only tools they know.
Also, afaik excel is not very good at importing CSVs.
For some end users, excel makes perfect sense.
Can't say I understand them, but that's how it is. If the spec says xlsx, then it's xlsx. :)
I thought (read: assumed) importing csvs was easy enough, assuming the data is such that it lends well to csv format
10:38
yeah, i mean, microsoft excel can open csvs without even blinking.
when cells start containing strings with newlines and other gems I wouldn't be so sure
10:56
Hey, I got it. I using pandas and tempfile module. and it works now.
thank you anyway.
Happy to share you guys ..
fp = tempfile.TemporaryFile()
df2.to_excel(fp)
# rd = df2.to_records()
# print(rd)
fp.seek(0)
return fp.read()
that's only useful if we know what you're trying to do, which we don't
thanks though
I used tornado as web server backend, and I want my my server can share some excel file, at very begin, I want to find a good way to covert my pandas dataFrame to some bytes stream. and I attempted to find something like pd.to_excel().to_stream()...But finally, I decide to save my excel file to somewhere else, and then read it as stream , so that I can use tornado handler any request, and then do self.write(my-file-stream). as my code show above. :)
@IljaEverilä Done
12:02
@PM2Ring cabbage, how are you? Is the heat getting more bearable come Autumn?
12:13
Cbg, @Andras Yes, it's cooled down a bit over the last week or so. We've had a few hot days, and a fair bit of rain.
has it been really dry as well (I mean drought), or just hot?
It's been mostly dry, but not as dry as last summer, when we had to water the lawn to stop it from dying.
:/ at least that's something
Yeah. Sydney's climate is pretty mild, especially near the coast, so I can't really complain.
12:36
cbg
13:08
does anyone know how to type-hint something like "X and Y", the same way typing.Union means "X or Y"?
as in "Iterable and AsyncIterable"
I'm pretty sure you can't, not without creating a class that inherits from X and Y
13:29
Do browsers care about file extensions? If I host an html page on my server but name it "foo.png", will browsers try to render it as a page, or as a png?
@Kevin Files get sent with a http header containing meta info, like MIME type, size, etc.
So if my page indicates "this is html" in the header, it doesn't matter that its name ends with .png?
Exactly
Cool, thanks
Conversely, you can have pages that have an image file extension, but which aren't actually image files. Eg:
13:34
I think imgur.com does something tricky with file types in order to make gifv and gif files interchangeable
I see that requests has a head method. That might be useful.
@Kevin Possibly. The server just needs to provide the proper meta data, and the client needs to know what to do in response. I haven't played with this stuff in a while, but IIRC, if the client doesn't know how to respond it'll ask you what app to open the file with, or if you want to save it to disk.
probably depends on the browser and settings
Probably. It can annoying when you click a text link that's supposed to be a .jpg, and the browser pops up the "save or open with" dialog instead of just showing you the image.
13:44
My firefox dev edition insists on opening jpgs with vanilla firefox. So what happens is I click on a link, wait half a minute, then see a popup telling me that firefox is already running (since I use the default profile for my dev edition).
It happens rarely enough and it's not inconvenient enough for me to track down the setting to change this behaviour :P I even suspect where I'd have to look.
I guess that might happen if the Mime type doesn't match the file data. Or something. ;)
PRY
PRY
It's off the topic but I need help. I am having 3D .nii images with same height and width but different depth. I want to make depth equal. How can I do that? Any little help will be helpful.
Not off the topic sorry.
Hmm, could be. Stuff like imgur images open in firefox directly...
@PRY just to be clear: you want to have all images to have the same depth, presumably as the "deepest" one, with values being padded with zeros?
@AndrasDeak My gods Firefox causes problems for the networks I administer with network home volumes. I end up having to have a login script to move ~/Library/Application Support/Firefox to /var/local, then symlink the user's Library folder to that. The 'Already Running' is a serious issue, given that type of singleton check is entirely optional.
(Ref: open -n)
as an end user I'm happy with firefox
13:47
Well, there's also the fact that the vertical market app on those networks is an EMR system called OSCAR, which demands a three year old version of Firefox be used…
¬_¬ Silly verticals.
PRY
PRY
@AndrasDeak thanks for help. But is it possible to take average and them modify images?
same, i like firefox. and i'd rather not rely on chrome down the line when google seems hell bent on taking over our lives, (meh whatever), and disabling ad blocking (not cool)
I think I'll try to write up an answer involving the MIME type. What's a nice reputable site I can use as an example, whose url ends in .php?
PRY
PRY
By average I mean average of depth.
@PRY I imagine anything is possible. I've never worked with 3d images but I'm comfortable with n-dimensional arrays. But "take average" isn't straightforward if the size of your images (along depth) differs
you'll probably have to come up with a specific recipe (algorithm) how to pad your images
13:49
I guess http://php.net/manual/en/security.hiding.php will do
Heh; I currently have 196 tabs open across 10 windows… and Safari's consuming 615MB of RAM, or ~3MB/tab. I have not had such success with Firefox.
196?!
Only four of which are currently receiving SSE push. XP
I've got 323 tabs in 1 window, for 25% of my 16 GB of memory
(I collect research tabs into problem- or domain-specific window groups. I tend not to close anything until the task/project/problem is done.)
13:51
but most of those tabs are not active
Four of those windows are currently minimized. The rest are two-up on one display, half the split on a second, and spread amongst a few full-screen spaces to boot.
PRY
PRY
@AndrasDeak do you know any python library which will help me.
@AndrasDeak So ~12.7MB/tab, then? :/
yup, something like that I guess
For what it's worth I haven't had memory issues since I doubled my RAM from 8 GB a few weeks ago... ;D
I think FF's memory usage is better measured in MB/sec
cuz the longer it's been open, the more it uses
I have 10 tabs @ 1.5 GB (150 MB per tab)
13:56
I've seen that, but I also regularly browse stuff like imgur and leave a bunch of tabs open, so I can't tell if the MB/sec is due to more open active tabs or just time...
@PRY If you're doing image processing of some kind, are you already familiar with "convolution kernels", and that approach for minimizing computational difficulty? I'm having my own difficulty groking your need from the intermittent chat here, so apologies if entirely off the mark. ^_^; (E.g. Separable Filters or Facial Recognition via the Viola Jones algorithm.)
a few versions ago (before I switched to dev edition) I would also see livestreams filling up memory :/ Haven't seen that in a while
@PRY sorry, as I said I've never worked with 3d images. If you can turn them into numpy arrays then numpy/scipy.ndimage and whatnot could be helpful
I don't know what .nii files are like and how they can be straightforwardly manipulated
@PRY I've never used .nii files, but according to the answer here they can be loaded into 3D Numpy arrays. Scaling the depth is, in principle, the same as scaling the width or height of a 2D image.
Huh; my own .nii imagery from my recent brain surgery incident are actually four-dimensional. They're 3D volumetric scans over time indicating blood flow through the region. :|
(Yay for doppler reconstruction.)
the Doppler-effect is a really useful beast
14:02
"So, why do you have to press so hard?" "To collapse the vein." "Wat." "Yup, see this? :press, vein looks like an eye winking: "Huh."
We're talking about pressing your brain?
No, groin in preparation for getting to the brain. Femoral artery punctures for fun and profit, with the complication of existing thrombosis.
Does requests have any way to get only the type and subtype from the header's Content-type? response.headers['Content-Type'] gives "text/html; charset=UTF-8" and I would like to just have "text/html".
(Thus the doppler and vein-crushing to make any obstruction visible.)
14:05
@amcgregor ah, that's just a bit reassuring :D
I could easily do type_and_subtype = response.headers['Content-Type'].split(";", 1)[0] but if the library already has that data pre-parsed for me somewhere, I'd prefer to use that
@PM2Ring Are you from Australian?
@Kevin Hmm; this might seem like adding an entire house instead of a new bedroom to the house, but WebOb's Request and Response representations have excellent support for proper parsing of the headers, and independent addressing of the parts. (E.g. charset separate from overall content type.)
I'm not married to requests so I can migrate to a different lib if it has better support for my particular needs
@Kevin WebOb is effectively just a Request/Response abstraction (which as a side effect speaks WSGI); it doesn't issue requests, it helps one write server-side code to process and return results for them.
Essentially I was suggesting ignoring Requests's response abstraction, use WebOB's more capable one, after the initial fetch.
14:08
@Kevin Sorry, you get what the server sends you, and for text that's supposed to include the encoding... which may not necessarily be truthful. ;) But I tend to trust http headers more than the meta data in the html page itself, especially if the html was generated by a Microsoft product. :)
I have a list of files with names like F_TR01_123_22012019.CSV.gz.all.csv.ipeak.csv , in the list 22012019 is the date and I want to sort it using the date. I am unable how to give date as the key to sorted() funtion in python
@FrankAK Yes, I'm Australian & I've lived here all my life.
@PM2Ring The servers that lie are why FTFY ("Fixes Text For You") was invented. I had bizarre encounters with some servers advertising UTF-8, delivering Latin1, except for one <section> which was ISO 8859-3 ("Latin-3"). Same-day'd a new desk after that.
i think i need to split using lambda as key
@pythonRcpp Try writing a function extract_date(s) that takes a file name and returns a datetime.datetime object. datetime.strptime will help there, but you may also need to do some string slicing and/or regex first. Once you have that function, you can do my_list_of_filenames.sort(key=extract_date)
It's too bad that the date-like portion of the filename doesn't adhere to ISO standards, or else you could just slice that part out and sort on the string data. Since the year comes last, it's not ISO compliant and lexicographic sorting won't give the right answer
14:14
@PM2Ring I've got a Working and Holiday Visa, and plan to go to Melbourne at October. looking for a job there .:)
YYYY-MM-DD 4 lyfe
Jun 5 '18 at 21:29, by PM 2Ring
From https://en.m.wikipedia.org/wiki/ISO/IEC_8859-1 It is very common (on the Internet) to mislabel Windows-1252 text with the charset label ISO-8859-1. Most modern web browsers and e-mail clients treat the media type charset ISO-8859-1 as Windows-1252 to accommodate such mislabeling.
(Harkening back to my earlier mention of OSCAR EMR for medical clinics) I've also had a few pharmacies as clients. Educating them on ISO date formatting and the importance of lexicographical sorting was… painful, but rewarding when suddenly they could find their sh^H^H^H documents back. XP
In[55]: name = "F_TR01_123_22012019.CSV.gz.all.csv.ipeak.csv"
In[57]: name.partition('.')[0].rpartition('_')[-1]
Out[57]: '22012019'
Then convert to date using something like datetime.strptime('22012019', '%d%m%Y')
sorted(glob.glob('./*2019*gz.all.csv.ipeak.csv'),key=lambda x: x.split("_")[3].split(".")[0])
14:17
^^ partition is how basically how I'd extract the date data. But I didn't want to suggest anything concrete because I don't know what the other file names look like
i tried the above... but sorting would need datetime
Things are gradually improving, but Wiki says:
@pythonRcpp Yes, that's essentially what I said.
datetime.strptime(name.partition('.')[0].rpartition('_')[-1], "%d%m%Y")
@pythonRcpp With the note that this pattern is only safe as a byproduct of there not being 19 or 20 months. ¬_¬
14:17
As of March 2019, 3.4% of all web sites claim to use ISO 8859-1.[3] However, this includes an unknown number of pages actually using Windows-1252 and/or UTF-8, both of which are commonly recognized by browsers despite the character set tag.
Please sign my petition to have the first R of "February" removed, because it doesn't get pronounced half of the time anyway
\o cbg
Are those the names of the months in Esperanto?
@pythonRcpp Seriously, use a proper def function for your key function, not a lambda. It will make it much more readable. And use partition rather than split. Or at least pass a maxsplits arg.
I just pronounce it with the r
14:22
you got me whispering February to myself to see how I pronounce it
There is some appeal to making all months into "uary"s, since then they would all have the same number of characters. I like my data to line up nicely when I use monospace fonts.
tried sorted(glob.glob('./*2019*gz.all.csv.ipeak.csv'),key=lambda x: datetime.strptime((x.split("_")[3].split(".")[0]),"%d%m%Y"))
looks ugly and doesnt run aswell
Define "doesn't run as well". If it works, it works.
The ugliness could be ameliorated by making an extract_date function, as I already suggested
@PM2Ring (Fun factoid aside: split with limit is slower than split is slower, by a substantial margin, than partition regardless of how you subsequently consume the partition results, e.g. unpacking, stepped iteration slice unpacking, etc.)
And also probably tightened up by using partition instead of split, as suggested by -2- 3 of us here
i meant to say it looks ugly and it gives error 'module' object has no attribute 'strptime'
/me reaching for the "garlic" key
@amcgregor How annoying. Actually, now you mention it I remember seeing that topic discussed here recently while I was lurking. Did anyone look at the source to figure out why split with a limit is slower?
@PaulMcG 🧄
@pythonRcpp Oops, I guess I got the module attribute path wrong. Go ahead and look through the datetime documentation to see where strptime is really defined. I'm sure it's in there somewhere
14:28
I haven't dived into it, but I was assuming the overhead of tracking iteration count, e.g. internal reliance on enumerate() or more lame local integer incrementing.
Vs. partition, which does one thing, only one thing, and does it well, and knows when to stop, always. ;)
strptime in Python is a little tricky because there's one in time & a different one in datetime. IIRC, the datetime one handles microseconds, the time one ignores them.
Kevin's Official Reformed Calendar
January
Febuary
Maruary
Apruary
Mayuary
Junuary
Sepuary
Octuary
Novuary
Decuary
//move Julius' and Augustus' months to the end of the year
//so that Sept/oct/nov/dec refer to the 7th/8th/9th/10th months as intended
Juluary
Auguary
you should fix that leap year and leap second thing while you're at it
Unresolved problems:
- Maruary and Apruary have the same "ruar" particle that gets mispronounced as "uar" in February.
- Sepuary loses 25% of its number prefix power because its T got sliced off.
- Dates in the latter half of the year will no longer have the same shortened date designation. e.g. Christmas is now Aug 25, not Dec 25.
Nah, start the year in March, moving Jan & Feb to the end. That simplifies leapyear handling, and gives a simpler pattern to the month lengths. That's the strategy used by a couple of day of the week algorithms, and daynumber algorithms.
14:36
sorted(glob.glob('./*2019*gz.all.csv.ipeak.csv'),key=lambda x: datetime.datetime.strptime(x.split("_")[3].split(".")[0],"%d%m%Y")) worked
thanks guys
I was half tempted to just use number prefixes for all the months, e.g. Unuary through Duodecuary, but then you don't get consistent name lengths
@pythonRcpp ew
@Kevin I'm a fan of having five, 73-day seasons / months. Makes everything easier. Today is Sweetmorn, the 66th of Chaos, YOLD 3185.
>:D
@pythonRcpp So you went with...none of the suggestions. Nice
How about... "01uary" through "12uary"
14:38
Also a fan of the FFF system; one firkin per fortnight ~= the speed of a snail.
I kind of like the idea of a lunisolar calendar, so that the months are synchronised with the Moon. OTOH, that means if you weren't born on a Full Moon you'd never get to have your birthday party on a Full Moon night.
fullers would be at the peak of society and newers would be sweeping the gutters
Also, modern Western civilization may not cope too well with having leap months. ;)
I want to live in a cyberpunk future where everyone's brainchip keeps track of the date and time and phase of moon and GPS position and various useful biometrics
It's amazing to me that we don't measure time in tau (or radians). Noon being half tau.
14:48
we should define a new constant for half tau because it keeps coming up everywhere
5
"It's π-o'clock!" :feasts on pie:
@AndrasDeak But what to call it? Isn't there a chart somewhere for constants like this?
We're used to the leap day being Feb 29, but in earlier times the leap day was actually inserted between the 24th & 25th of Feb, IIRC.
Then we don't need a human-readable date system, you can just say "I'll be over at <dialup noise corresponding to the Unix timestamp of an hour from now>, see you then" and the listener's brainchip will parse it for them
@PaulMcG ha!
14:50
Like a tau chart?
Rbrb - off to the auto shop
@Kevin neat, we could have awkward conversations with others in our heads. ...wait, how would it be different again?
rbrb, I'm leaving too
@PaulMcG Seems simple enough to me, visually. 𝛕 → just slap another leg on it → π. ;P We must call this: T_PAAMAYIM_רגל (because unicode symbols should totally be allowed; silly romanization bias! ;)
From en.wikipedia.org/wiki/Leap_year To create the intercalary day, the existing ante diem sextum Kalendas Martias (February 24) was doubled,
(The PHP original meaning "double colon", the above meaning "double-legged".)
Leap days should be inserted into the year at random, and the public should only be informed of it the day before, and everyone should take the day off, and it should be named NULL instead of having a number. This is an excellent plan.
15:06
ooh, i like the sound of that
There are also no laws and no emergency services available on NULL, so this plan should only be implemented in the cyberpunk future where everyone is a largely indestructible cyborg and private property doesn't exist.
"Yeah, last NULL my neighbor chopped off my head and burned down my house. All in good fun, nothing that the universal assembler couldn't fix"
m8_
m8_
Morning! is there anyone I can limit this line of code to specific, multiple columns? df3.isnull().sum(axis=1)
anyway*
If I have 5 columns, but only want that to check 3 of the 5, for instance
Fun fact - you can edit your posts for up to two minutes
@Kevin Very down and out, there. (Being killed off to erase memories learned since the main character's last backup being a major plot point.)
Yes, my imagined cyberpunk future is more Cory Doctorow and less Blade Runner
m8_
m8_
15:17
nevermind, I believe I can use df3.filter(items=['col1','col2']).isnull().sum(axis=1)
I, row boat.
Though his "Sysadmins Inherit the Earth" novella was… a disturbingly reasonable approximation of that type of end-of-the-world scenario. ¬_¬
Huh. Darn you, twine. (I miss my old ./setup.py sdist bdist_wheel --sign upload pipeline…) You prompt me for credentials despite my registering credentials with keyring for that endpoint, I enter credentials, you die complaining that credentials were not given. 403 Client Error.
15:52
Even setting credentials (tested in-browser as valid) via environment fails.
O_o
@m8_ or just df3[['col1', 'col2']].isnull().
wim
wim
16:26
PSA: update your chrome browser to 72.0.3626.121 zdnet.com/article/… that is a really bad vulnerability
m8_
m8_
@AndrasDeak, maybe I'm thinking to hard, but I basically want to create a new column that shows 1 if the number of nans for a certain column are greater than 3, for instance.
I omitted the .sum(...) bit because I was lazy...
my point was that you can index into columns, no need to call .filter
m8_
m8_
gotcha, that makes sense. Im trying to use np.where to say if the columns have more than 3 nans, add 1 to the new column, otherwise nothing.
if the rows have more than 3 nans, I mean
16:46
Would it be possible to reopen the following question: stackoverflow.com/questions/55047745/… Though it seemed to be a simple sort_values problem at first, the added requirement to preserve the initial ordering makes the duplicate answers irrelevant. Or I'm happy to keep it closed if someone can find a more relevant duplicate to flag it with
m8_
m8_
got it, `df_filtered['Summary'] = np.where(
(df_filtered.count(axis=1) > 1), 'Pass', '')`
Looks good to me, voted to reopen
retagged with python now...
Kevin you badly need poke's hammer warning script :P
OK, now it's open and rehammered again
:-I
What does the script do?
17:01
it shows a warning if you're trying to dupe-close something and it's not tagged with your gold badge...come to think of it I'm not sure it works for unhammers as well
@ALollz Reopened
Was the new dupe also inadequate? I didn't check.
@AndrasDeak What new dupe? ALollz gave an answer suggestion in a comment.
with this event that happened when the post was almost reopened by us:
Oops. Sorry guys, didn't mean to reopen. — Scott Boston 11 mins ago
9 mins ago, by Andras Deak
OK, now it's open and rehammered again
to a new target ^
I'm confused. Do we want the question opened or closed?
17:10
The only certainty is that the original target was bad and that ALollz has an answer. Whether the new dupe was correct is in question, I never checked. I also have to leave now :) rhubarb
Oh. :(
I wanted it reopened because "I have an answer composed and ready to submit, if only this question was open for another five seconds" is a frustration I frequently experience and I would like to prevent that pain in others
@Kevin That's what I thought, too.
@ALollz Do you want to post an answer, or should we hammer it?
I don't know Pandas, so I can't easily judge the quality of any proposed dupe targets.
Hello, may I have question about Python's regex?
Looks like ALollz has been waylaid by an angry panda...
17:21
I need to start matching from ": "
So I probably need to combine '(?<=:\s)' and '\b\w\w' somehow. Is it possible please?
(?<=:\s)\b\w\w
Aran-Fey: ok, but this will match only that word "Ut" right after ": ". I need to match first 2 characters from every word after ": ".
wim
wim
@AndrasDeak You were right about that attribution thing
regex can't do that. Use python to remove everything before the colon, then find matches in the remaining text
wim
wim
The other day a handful of my old answers were bulk deleted by moderators as spam for not disclosing some OSS authorship
17:27
@FilipCZ Why not use findall?
thank you guys for hint @PM2Ring I'll think about it
wim
wim
Reluctantly, will ensure to mention it in future. I don't really like this rule because if you have to mention authorship each and every time it could end up to sound like you're bragging. 😒
I learned the hard way that search and/or match can't capture a variable number of groups
If you have one pair of parens in your pattern, you will have at most one group in the result
@wim OTOH, if you don't mention authorship, you leave yourself open to accusations that you're tricking people into using your code. Explicit is better than implicit. ;)
@Kevin And that's why I suggested findall
Yes findall seems appropriate for what I interpret the problem to be
17:40
Also, I try to keep my regexes as simple as possible, so that when I update the code in 6 months I don't have to spend 5 minutes decoding each regex. So I often end up making a few passes over the data, rather than trying to get it done in a single pass with an unreadable regex.
> I don't often regex, but when I do ...
If my regex contains anything more complicated than literal characters and "(.*?)" then I assume it will very quickly become write-only code
I'll still write regexes from hell, but with the understanding that I will never ever be able to extend its functionality
wim
wim
17:59
@PM2Ring I get it, but such an accusation just doesn't hold water in the context of OSS (like an MIT or Apache licence)
18:24
@wim ah, I see
cbg
In the Django admin site, how can I disallow editing an object while still allowing the user to view it?
I'm sorry that I had to hear "you were right" under such dark circumstances :P
i really like keeping my python functions and stuff in separate files (e.g. - i might have a folder called "utils" with some __init__.py that imports all the files in said folder, and each utility function is defined in its own file)
@wim looking up what I dug up the last time, it might help a lot if you disclose ownership in your profile
is there some major downside to this that i'm not aware of?
(this just feels a lot cleaner to me)
(but i've read that one isn't supposed to do that in python)
18:28
@AmagicalFishy fyi, you should use backticks to avoid dunderbold names
__init__.py
word :D
you can also edit/delete for 2 minutes
yes, like that ;-)
@AmagicalFishy keeping every single function in a separate file is probably overkill. Having a bunch of submodules being imported in __init__.py is not necessarily a bad thing. Where did you read the "one isn't supposed to do that"? Such claims usually only make sense in context.
Having lots and lots of modules is a pain because then you have to think up lots and lots of module names. But if they're all going to get gathered up under a single util, then that's not so big of a deal.
18:30
i read it on a stack exchange post at some point, actually; someone made the claim that python is meant to have a bunch of functions in one file (because of something something the-way-it's-structured)
yeah. it just ends up being something like: "from utils import helper_function" and, in the __init__.py, there's something like "from .helper_function import helper_function"
I think most arguments in favor of fewer files will hinge on more abstract principles of cohesion/encapsulation than anything along the lines of "Your program will break / perform worse if you do it this way"
the only problem i've noticed so far is that, in order to patch these functions (when i'm testing or something) i have to use sys
Conceptually similar pieces of code should be close to one another. If they're not in the same file, they're not close to one another. That's pretty much the crux.
ah, yeah.
i can dig that
it's good to know that my keyboard isn't going to explode because of it or something crazy, though :D
Rule of thumb: manipulating sys.path is typically more effort than it's worth
18:36
oh. i don't have to do any of that. i just have to do: @patch.object(sys.modules['sound.views.config'], 'run_test') for example
by the looks of it sound.views.config should work just as well in that context?
I know nothing about patching but it's curious to me that the roundabout approach would be necessary
or sound.views.config is not sys.modules['sound.views.config']?
>>> import sys
... import scipy.spatial.distance
... print(sys.modules['scipy.spatial.distance'] is scipy.spatial.distance)
True
so as long as your module names are literals you can just use the module object itself (woo python)
>>> sys.modules['scipy.spatial.distance'] = lambda: 'yoink'
... print(sys.modules['scipy.spatial.distance'] is scipy.spatial.distance)
False
please don't do that
18:59
@AndrasDeak it doesn't work w/ patching: so, in this case, there is a file sound/views/config.py and a statement in sound/views/__init__.py that's from .config import config
00:00 - 19:0019:00 - 00:00

« first day (3064 days earlier)      last day (2108 days later) »