« first day (4897 days earlier)      last day (68 days later) » 

3:59 AM
Surely there's a duplicate for this? stackoverflow.com/questions/78150987
 
4:18 AM
@roganjosh Depends if you meant speciically "python when you said "programming standards". R language has a more evolved take on NAs, it allows multiple different non-equal values of NA. There are many use-cases, one such is to signal the distribution or production mechanism that caused the NAs: Missing completely at random (MCAR)/ Missing at random (MAR)/ Missing not at random (MNAR).
... For example the causes (in a survey on e.g. political party affiliation) could be "no affiliation", "don't know", "not applicable" (e.g. respondent is too young/ not an eligible voter", "refused to say" [which statistically carries different information to saying "don't know"], "survey records omitted/correputed/redacted", "audio transcription failed", "survey enumerator forgot to ask/record answer" etc. etc. We might well want to treat these as different types of NA...
... not just for sampling, but also for NA imputation (which is a very very tricky business where statisticians roll their eyeballs at 99% of the fast-and-dirty practices that data scientists do).
(To be clear, from my recollection, a small number of R packages support the concept of multiple NA types, I can't find their names now. But more generally, the significance of NA can vary hugely depending on where in a pipeline it occurs)
Here's a user migrating to pandas from STATA who asked the same in 2022, no answers yet: Can you specify different "categories" of missing values in Python?
Oh and also there's IEEE negative zero in python
..although np.equal(-0.0, 0.0) gives True, they can behave differently with functions which copy sign, like atan2.
 
5:07 AM
@smci huh, I didn't think I would be looking to R for a neat feature, but that actually makes a lot of sense. And indeed, negative zero was a decent candidate but on thinking about it I think NaN (and its variations) is the only one backed with a standard like IEEE
 
 
3 hours later…
7:48 AM
@smci Is "multiple NA types" really the same concept as nan's "not equal to itself"? This sounds more like multiple Nones, i.e. not the real value but still something one can identify.
NAN isn't just unequal to other nans but literally to itself. One Nan is One Nan not equals One Nan.
>>> one_nan = float("nan")
>>> one_nan == one_nan
False
 
 
6 hours later…
1:24 PM
If anyone is up for a bounty, there's a few measly rep to be earned for digging into asyncio. IMO both the docs and answers are wrong in practical situations, so I'm looking for confirmation or definitive proof otherwise.
 
I just found out that my vscode hasn't been updating for around 6 months. How the heck did that happen?
 
@Aran-Fey That discussion on vectors & points reminded me of this: Torsors Made Easy, by John Baez.
SVG has a few ways of making rectangles. <rect> is for axis-aligned rectangles. You specify the location (of the top left corner) and the width & height. The default location is the origin (which is the top left of the viewing region). But you can also make rectangles using <polygon> (or <polyline>) or <path>.
<polygon> & <polyline> attributes are point coord lists. A <path> is specified by a list of drawing commands, which can be linear, circular or elliptical arcs, or quadratic or cubic Bézier curves. So it's very versatile.
Samsung, in their infinite wisdom, apply different colour transformation rules to <rect> and <path> in their forced dark theme. So regions that look identical in the light theme can look radically different when using the forced dark theme.
 
1:47 PM
What's a "forced" dark theme?
 
It makes Web pages dark, even if they aren't designed to explicitly support a dark theme. Chrome also has a "forced dark" mode option.
 
Ah, just spotted it as a Chrome option. I would have thought that it would be down to the browser to handle the styling in that case
 
Many would agree with you. But Samsung have other ideas...
 
@PM2Ring I have a vague sense of how that's related to the vector/point discussion, but I can't follow that explanation at all. The WTFs/paragraph of that article are very high
 
To be fair, it's mostly ok. It just has a few bizarre quirks that Samsung refuse to change, despite the complaints.
Samsung also has a normal dark theme mode, which behaves properly. But of course it only works if the Web page explicitly has a dark theme.
@Aran-Fey Give it time to sink in. :)
> Whenever I teach students about vectors they find this stuff very confusing. The reason is that we're using vectors in two different ways. If your teacher didn't explain this stuff well, call them up and tell them "You should have told us about torsors!"
The really annoying thing about Samsung's forced dark mode is that the usual things that a Web page can do to detect if the user wants dark mode don't work in forced dark mode. So your CSS & JavaScript behave as if the user's preference is for a light theme. And then Samsung messes with whatever the server delivers to make it look dark.
 
2:14 PM
Did you get a chance to listen to thank song I suggested btw @PM2Ring? It was a while ago now so not sure whether the notification will have worn away
 
@roganjosh Malinda? I'd forgotten about it, but I just listened to it then. She's good!
 
Yeah. I've listened to quite a lot of her stuff now and I'm really impressed :)
 
Are you familiar with Scottish comedian Eleanor Morton? She has a bunch of skits revolving around Craig the unenthusiastic tour guide, eg youtu.be/5w3nyURvWn8?si=HzcM-Wwyq_pjf5Tv
Here are a couple of other skits from Eleanor (not based on Craig) youtu.be/4VKhfCeQSY4?si=pLOriSknw4eoIWbJ & youtu.be/IhNSdNQS4R4?si=6m5Ze4Ls4lHZwzsD
 
2:39 PM
Here's a Northern comedian you might appreciate, gdiddlydog. youtu.be/uQox5VscRnE?si=hfiPqlkR6TdX4Q-r
 
3:18 PM
Will try check them out shortly, just trying to finish something up
I must surely be one of the first people to compress an image to a file size greater than the original? My compression has gone from 3MB as an online upload to 8MB on disk... Alchemy is real.
 
3:45 PM
@roganjosh Well, no lossless compression mechanism can conpress everything. So (usually) compression software just returns the original if the "compressed" version is larger. From en.wikipedia.org/wiki/…
> any lossless compression algorithm, provided it makes some inputs smaller (as "compression" suggests), will also make some other inputs larger.
 
I realised what the issue was. I was going from JPEG to PNG without realising. So even though I massively scaled down the pixel size, the file size ended up bigger. It just amused me that my attempt to limit server storage went horrendously in the wrong direction :)
 
Typical images compress well, due to lots of structure in the image that the compression algorithm can detect. But if you try to compress a very noisy image, it's unlikely that the result will be smaller than the original.
@roganjosh Ah. That'll do it. :)
 
I got it down from 3MB to 135KB and it still looks relatively decent. It's not for holiday snaps but random bits of inventory so I don't need it to be too sharp. Plus the compression is done on the front end so that should speed things up nicely when they submit the form
 
A couple of decades ago there was some excitement around fractal-based image compression. If you can represent an image as a fractal then you can compress it into a tiny size, although it may take a lot of time to compress & decompress.
I saw some rather impressive examples. Unfortunately, the algorithm was patented, and failed to gather much support, and was never fully developed into a general usable system (AFAIK). Also, the timing was bad: the graphics community was very anti-patent at that time, due to the GIF debacle whuch had directly led to the development of PNG.
Here's a very simple example. This fractal fern is specified by 28 low-precision floats. And a fractal viewer can zoom into it indefinitely. From en.wikipedia.org/wiki/Barnsley_fern
With that sort of IFS fractal, decompression is quite fast. But finding the IFS matrices that correspond sufficiently well to a generic source image is rather slow.
 
4:12 PM
@PM2Ring This couldn't be closer to home for when I was growing up :)
 
@roganjosh Ah, yeah. I've seen that before.
 
4:47 PM
Hello, is there any way to recover some folders accidently deleted with shutil.rmtree ?
 
5:21 PM
@ChrisP There's nothing Python itself can do to recover deleted files. But you might be able to recover those files using a tool like cgsecurity.org/wiki/PhotoRec The important thing is to avoid writing to that filesystem before attempting recovery.
 
 
3 hours later…
8:44 PM
@PM2Ring I solved with Local History of PyCharm.
The error was: if folder_name is not "test-contents": -> shutil.rmtree(folder_name), and the correct was if folder_name != "test-contents": -> ...
The folder_name was: for folder_name in os.listdir(path):
It seems that folder_name wasn't of type str.
 
9:13 PM
@ChrisP No, that's not true. if folder_name is not "test-contents": is deeply flawed because it would assume that the file name string was interned. It's still a string but you're relying on the identity check of "is", which you should really not be using in this case.
 
 
2 hours later…
10:57 PM
@GeorgesLeukic hello. Please see the room rules in particular, waiting 48 hours after posting before you bring questions to the room
 

« first day (4897 days earlier)      last day (68 days later) »