News for hackers. Stuff that matters.
Re:Loading Data into Pandas: Tips and Tricks You May or May ... by Helmut10001 on Thursday August 04, 2022 @10:47PM (#32350968)
Not to taunt about the article, but the most important pandas parameters to me are `iterator=True` and `chunksize=x`, for streamed processing. Here's an example for processing a CSV file with 400 Million latitude and longitude coordinates.[1]

[1]: https://ad.vgiscience.org/twitter-global-preview/00_Twitter_...

Re:Loading Data into Pandas: Tips and Tricks You May or May ... by jwilber on Thursday August 04, 2022 @10:58PM (#32351026)
This is a great mention, ty!
Re:Loading Data into Pandas: Tips and Tricks You May or May ... by nl on Thursday August 04, 2022 @09:55PM (#32350579)
I find pd.read_sql pretty useful for integration with SQLLite too.

https://pandas.pydata.org/docs/reference/api/pandas.read_sql...

Re:Loading Data into Pandas: Tips and Tricks You May or May ... by owlninja on Thursday August 04, 2022 @10:12PM (#32350703)
I find pd.read_sql and SQLAlchemy very handy sometimes.
Re:Loading Data into Pandas: Tips and Tricks You May or May ... by wenc on Thursday August 04, 2022 @10:53PM (#32351000)
I’ve mostly replaced pd.read_csv and pd.read_parquet with duckdb.query(“select * from ‘x.csv’) or duckdb.query(“select * from ‘y/*.parquet’).

It’s much faster because DuckDB is vectorized. The result is a Pandas dataframe.

Querying the Pandas dataframe from DuckDB is faster than querying it with Pandas itself.

Re:Loading Data into Pandas: Tips and Tricks You May or May ... by ashwal on Thursday August 04, 2022 @09:45PM (#32350518)
Some good tips in here, I've find myself reaching for JSON/excel methods often.

Despite using it for years, I still haven't decided if pandas is poorly architected or if the clunkiness (for lack of better of term) is a result of the inherent difficulty of the tasks.

Re:Loading Data into Pandas: Tips and Tricks You May or May ... by hansvm on Thursday August 04, 2022 @09:53PM (#32350567)
I seem to remember the author awhile back writing about how it was their first major project and there were a ton of things they'd learned and would like to change.
Re:Loading Data into Pandas: Tips and Tricks You May or May ... by char101 on Thursday August 04, 2022 @11:27PM (#32351192)
Another tip: use https://github.com/sfu-db/connector-x to load database query result to pandas without memory copy resulting in faster operation.
Re:Loading Data into Pandas: Tips and Tricks You May or May ... by bushbaba on Thursday August 04, 2022 @10:04PM (#32350652)
I wish I knew about json_normalize sooner. JSON is great, but needing to transform it to a CSV/Excel sheet is a toil. Great to know about this one-liner!!
Re:Loading Data into Pandas: Tips and Tricks You May or May ... by lettergram on Thursday August 04, 2022 @10:06PM (#32350662)
I spent some time working on something called DataProfiler python library

https://github.com/capitalone/DataProfiler

The gist is that you can point to any common dataset and load it directly into pandas.

from dataprofiler import Data

data = Data("your_file.csv") # Auto-Detect & Load: CSV, AVRO, Parquet, JSON, Text, URL

I simply hate dealing with loading data, so it's my go-to.

Re:Loading Data into Pandas: Tips and Tricks You May or May ... by pineapplejuice on Thursday August 04, 2022 @11:51PM (#32351370)
My tip is to keep a dict of all the fields and the data types you expect them to be, particularly strings. In my company we have IDs that start with zeros, or are a mix of numbers and letters, and get interpreted as numeric types. I'm frequently pulling data out of the DW with the same fields, so I just have to use the dtype= arg point it to my dict and it takes care of that for me.
Re:Loading Data into Pandas: Tips and Tricks You May or May ... by IntrepidWorm on Friday August 05, 2022 @07:58AM (#32354857)
In my experience, the best way to load data into pandas is https://www.atlassian.com/software/bamboo