Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Cheat sheet · Specialise

Pandas cheat sheet

Opens with credits

A quick-revision book on pandas for anyone cleaning and analysing tabular data in Python: loading files, selecting and filtering, fixing missing values, grouping, joining, reshaping and working with dates. Snippets follow current pandas, where copy-on-write is the default and chained assignment no longer works.

Curated by Tauseef Fayyaz10 chapters63 concepts74 glossary terms

Chapters

10 chapters · 63 concepts

  1. 1Loading and saving dataThe two objects pandas is built on, how to read CSV, Excel, SQL and Parquet into them, and how to write results back out.6 concepts
  2. 2Selecting rows and columnsPicking columns, the difference between loc and iloc, the index, and how copy-on-write changes what happens when you modify a selection.6 concepts
  3. Filtering and sortingBoolean masks, combining conditions, query, membership tests and sorting.6 conceptsOpens with credits
  4. Cleaning and missing valuesFinding and handling missing values, fixing types, removing duplicates and renaming columns.7 conceptsOpens with credits
  5. New columns and transformationsCreating columns with vectorised maths, assign, pd.col, conditional logic, binning, map and apply, and text and category helpers.7 conceptsOpens with credits
  6. Grouping and aggregatingSplit, apply, combine: groupby with named aggregations, transform, counting, pivot tables and crosstabs.7 conceptsOpens with credits
  7. Merge, join and concatCombining tables side by side on keys, stacking them on top of each other, and checking that a join did what you expected.6 conceptsOpens with credits
  8. ReshapingSwitching between long and wide tables with melt, pivot, stack and unstack, and expanding list columns.5 conceptsOpens with credits
  9. Dates and time seriesParsing dates, the .dt accessor, resampling, rolling windows, shifts and time zones.7 conceptsOpens with credits
  10. Performance and good habitsKeeping pandas fast and memory-light, and writing analysis code others can rerun.6 conceptsOpens with credits
  11. 11Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.74 terms

About this sheet

Reading data, selecting, filtering, missing values, groupby, merge and join, reshaping and dates in pandas, with copy-on-write in mind.

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com