• QuizzaciousOtter
    link
    fedilink
    English
    405 months ago

    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
      link
      English
      26
      edit-2
      5 months ago

      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
        link
        fedilink
        English
        145 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
        link
        fedilink
        English
        85 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
        link
        English
        45 months ago

        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.)

        • @[email protected]
          link
          fedilink
          English
          15 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
        link
        fedilink
        English
        15 months ago

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

    • @tequinhu
      link
      English
      105 months ago

      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

      • @[email protected]
        link
        fedilink
        English
        85 months ago

        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
          link
          English
          3
          edit-2
          5 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
      link
      English
      85 months ago

      Is 600 MB a lot for pandas?

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

      • QuizzaciousOtter
        link
        fedilink
        English
        35 months ago

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

    • @[email protected]
      link
      fedilink
      English
      55 months ago

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

      • @[email protected]
        link
        fedilink
        English
        135 months ago

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

        • Diplomjodler
          link
          English
          45 months ago

          Why do you have to personally attack me like that?

        • @[email protected]
          link
          fedilink
          English
          35 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 ☺️

    • @mvirts
      link
      English
      15 months ago

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

      • QuizzaciousOtter
        link
        fedilink
        English
        15 months ago

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

        • @mvirts
          link
          English
          15 months ago

          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.