this post was submitted on 02 Aug 2024
343 points (97.5% liked)

Science Memes

10940 readers
2350 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.

This is a science community. We use the Dawkins definition of meme.



Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS
 
top 36 comments
sorted by: hot top controversial new old
[–] Kausta@lemm.ee 66 points 3 months ago (3 children)

You havent seen anything until you need to put a 4.2gb gzipped csv into a pandas dataframe, which works without any issues I should note.

[–] thisfro 24 points 3 months ago

I raise you thousands of gzipped files (total > 20GB) combined into one dataframe. Frankly, my work laptop did not like it all that much. But most basic operations still worked fine tho

[–] QuizzaciousOtter@lemm.ee 13 points 3 months ago (1 children)

I really don't think that's a lot either. Nowadays we routinely process terabytes of data.

[–] Kausta@lemm.ee 9 points 3 months ago

Yeah, it was just a simple example. Although using just pandas (without something like dask) for loading terabytes of data at once into a single dataframe may not be the best idea, even with enough memory.

[–] whotookkarl@lemmy.world 5 points 3 months ago

It's good to see the occult is still alive and well

[–] QuizzaciousOtter@lemm.ee 41 points 3 months ago (5 children)

Is 600 MB a lot for pandas? Of course, CSV isn't really optimal but I would've sworn pandas happily works with gigabytes of data.

[–] MoonHawk@lemmy.world 26 points 3 months ago* (last edited 3 months ago) (5 children)

What do you mean not optimal? This is quite literally the most popular format for any serious data handling and exchange. One byte per separator and newline is all you need. It is not compressed so allows you to stream as well. If you don't need tree structure it is massively better than others

[–] QuizzaciousOtter@lemm.ee 14 points 3 months ago

I think portability and easy parsing is the only advantage od CSV. It's definitely good enough (maybe even the best) for small datasets but if you have a lot of data you need a compressed binary format, something like parquet.

[–] elmicha@feddit.org 8 points 3 months ago

But which separator is it, and which line ending? ASCII, UTF-8, UTF-16 or something else? What about quoting separators and line endings? Yes, there is an RFC, but a million programs were made before the RFC and won't change their ways now.

Also you can gzip CSV and still stream them.

[–] merari42@lemmy.world 4 points 3 months ago (1 children)

Have you heard that there are great serialised file formats like .parquet from appache arrow, that can easily be used in typical data science packages like duckdb or polars. Perhaps it even works with pandas (although do not know it that well. I avoid pandas as much as possible as someone who comes from the R tidyverse and try to use polars more when I work in python, because it often feels more intuitive to work with for me.)

[–] driving_crooner@lemmy.eco.br 1 points 3 months ago

I used to export my pandas DataFrames as pickles, but decided to test parquet and it was great. It was like 10x smaller and allowed me to had the the databases on a server directory instead of having to copy everything to the local machine.

[–] candyman337@sh.itjust.works 1 points 3 months ago

If you have a csv bigger than like 500mb you need more than 8gb of ram to open it

[–] HappyFrog@lemmy.blahaj.zone 1 points 3 months ago

Wait till you hear about WSV

[–] tequinhu@lemmy.world 10 points 3 months ago (1 children)

It really depends on the machine that is running the code. Pandas will always have the entire thing loaded in memory, and while 600Mb is not a concern for our modern laptops running a single analysis at a time, it can get really messy if the person is not thinking about hardware limitations

[–] naught@sh.itjust.works 8 points 3 months ago (1 children)

Pandas supports lazy loading and can read files in chunks. Hell, even regular ole Python doesn't need to read the whole file at once with csv

[–] tequinhu@lemmy.world 3 points 3 months ago* (last edited 3 months ago)

I didn't know about lazy loading, that's cool!

Then I guess that the meme doesn't apply anymore. Though I will state that (from my anedoctal experience) people that can use Panda's most advanced features* are also comfortable with other data processing frameworks (usually more suitable to large datasets**)

*Anything beyond the standard groupby - apply can be considered advanced, from the placrs I've been

**I feel the urge to note that 60Mb isn' lt a large dataset by any means, but I believe that's beyond the point

[–] marcos@lemmy.world 8 points 3 months ago (1 children)

Is 600 MB a lot for pandas?

No, but it's easy to make a program in Python that doesn't like it.

[–] QuizzaciousOtter@lemm.ee 3 points 3 months ago

Oh, I know, believe me. I have some painful first-hand experience with such code.

[–] gigachad@sh.itjust.works 5 points 3 months ago (2 children)

I guess it's more of a critique of how bad CSV is for storing large data than pandas being inefficient

[–] zaphod@sopuli.xyz 13 points 3 months ago (2 children)

CSV is not optimal, but then someone shows up and gives you 60GB of JSON instead of 600MB of CSV.

[–] Diplomjodler3@lemmy.world 4 points 3 months ago

Why do you have to personally attack me like that?

[–] naught@sh.itjust.works 3 points 3 months ago

Or they dump their entire 6gb SQL database, customer info and all, into a SQL file that you have to load into a mariadb docker container when you just needed a subset that you were going to turn into csv anyway ☺️

[–] ikilledlaurapalmer@lemmy.world 4 points 3 months ago

Fine! .csv.gz ftw!

[–] mvirts@lemmy.world 1 points 3 months ago (1 children)

It's more likely you'll eat up storage when you read a 600mb parquet and try to write it as CSV.

[–] QuizzaciousOtter@lemm.ee 1 points 3 months ago (1 children)

I mean, yeah, that's the point of compression. I don't quite get what you mean by that comment.

[–] mvirts@lemmy.world 1 points 3 months ago (1 children)

Ah I was trying to point out that CSV is the inefficient format. Reading a large amount of data from a more efficient format like parquet is more likely to cause trouble because the memory required can be more than the file size. CSV is the opposite where it will almost always use more disk space than is required to represent the data in memory.

[–] QuizzaciousOtter@lemm.ee 1 points 3 months ago

Right, true!

[–] mvirts@lemmy.world 31 points 3 months ago

600MB? What is this, 2004?

[–] anzo@programming.dev 22 points 3 months ago (1 children)

pola.rs enters the chat...

[–] troyunrau@lemmy.ca 2 points 3 months ago

Hell, depending on what you're doing, reading it into a numpy array instead of a panda dataframe will yeild huge performance gains too.

Been meaning to try polars... Haven't had a good excuse yet :)

[–] fadhl3y@lemmy.world 5 points 3 months ago

No, just buy some more RAM. 64Gb is the minimum for a professional data analyst. 128Gb, is the sweet spot.

[–] wallmenis@lemmy.one 5 points 3 months ago

Just read a few at a time...

[–] Buddahriffic@lemmy.world 3 points 3 months ago (1 children)

Did taking that picture damage that gun? It doesn't look like the barrel is parallel to the rest of the frame (or whatever it's called).

Or is it deliberately angled upwards to add some automatic bullet drop compensation to the sights?

[–] randombullet@programming.dev 6 points 3 months ago

Barrels are angled upwards to unlock the chamber and allow the bullet to ride into the chamber easier.

[–] ColeSloth@discuss.tchncs.de 2 points 3 months ago

"Constipated"

[–] FiniteBanjo@lemmy.today 2 points 3 months ago

CSV are a cool concept. Not so much any standard but rather a text doc where values are separated by commas. Sometimes banks use them and its hell to format them for Excel. Sometimes its just a list of readable words and values.

I had to build a Twitch Bot to add banned words in a CSV to a black list a while back, wish they would just let you copy paste like YT does.