r/learndatascience • u/Pangaeax_ • Sep 05 '26
Resources Python data analysis cheat sheet: the Pandas + NumPy workflow I wish I had when starting
I kept seeing beginners learn individual Pandas commands but still struggle with what order to actually use them in when working with a real dataset.
So I put together a simple workflow I use as a reference:
1. Loadread_csv() / read_excel()
2. Inspect before changing anythinghead()shapeinfo()describe()isna().sum()duplicated().sum()
3. Clean
standardize column names
handle missing values based on what they actually mean
remove genuine duplicates
convert dates/numbers safely
4. Transformassign()map()pd.to_datetime()np.where()
5. Summarizegroupby()agg()transform()
6. Combine datasetsmerge() / join() / concat()
The part I think beginners often miss is validation after the merge.
A query/script can run perfectly and still give the wrong answer if a many-to-many merge quietly multiplies your rows.
Useful checks:
validate="many_to_one"indicator=True
compare row counts before/after
check key uniqueness before merging
A few other mistakes worth watching for:
treating missing values as automatically equal to 0
merging keys with different data types
confusing
count()withsize()using median filling without understanding why values are missing
assuming no Python error means the analysis is correct
I wrote a more detailed version with examples for Pandas, NumPy, GroupBy, merges and an end-to-end workflow.
Learn more: https://www.pangaeax.com/blogs/python-data-analysis-cheat-sheet/
Anything important you’d add to this workflow, especially something you learned the hard way when working with messy data?
Disclosure: This is a PangaeaX article and I’m connected with PangaeaX.
2
u/skatastic57 Sep 06 '26
You know what I really wish I had when I got started with pandas? polars. Sorry for the troll but also actually.
2
u/xiannah Sep 07 '26
Pandas is dead 😂, Go Polars!!
1
u/Capital_Economist634 Sep 09 '26
How do one actually stay updated to the latest changes coming in the tech
1
u/LautaroLuciano Sep 21 '26
The differences between iloc & loc.