Chapter 10: Pandas¶
This chapter covers pandas, the essential data analysis library in Python, including Series and DataFrame objects, data loading, filtering, manipulation, merging, reshaping, groupby, time series, and performance optimization.
10.1 Overview¶
10.2 Core pandas Objects¶
10.3 Creating DataFrames¶
- DataFrame Creation
- Series Creation
- Loading CSV Files
- Loading Excel and JSON
- Loading SQL and Parquet
- Saving DataFrames
10.4 DataFrame Inspection¶
10.5 Filtering Data¶
- Boolean Indexing
- query Method
- isin Method
- between Method
- String Methods
- eval Method
- select_dtypes Method
10.6 Data Manipulation¶
- Renaming Axes
- Type Conversion with astype
- map Method
- apply Method
- apply with axis
- Sorting by Index and Values
- assign Method
- drop Method
- drop_duplicates Method
- clip Method
10.7 Handling Missing Data¶
- Detecting Missing Values
- fillna Method
- fillna Keywords
- interpolate Method
- dropna Method
- dropna Keywords
- replace Method
10.8 Aggregations¶
10.9 Accessor Methods¶
- String Accessor (str)
- String Methods Reference
- Datetime Accessor (dt)
- Datetime Methods Reference
- Categorical Accessor (cat)
10.10 Categorical Data¶
- Introduction to Categoricals
- Creating Categoricals
- Memory Efficiency
- Ordered Categoricals
- Categorical Operations
- Binning (cut and qcut)
- One-Hot Encoding (get_dummies)
10.11 Merging DataFrames¶
- merge vs join
- merge Method
- Keyword - on
- Keyword - left_on right_on
- Keyword - how
- Keyword - suffixes
- Keyword - indicator
- Self Merge
- Cross Merge
- merge_asof Method
10.12 Joining DataFrames¶
10.13 Concatenating DataFrames¶
- concat Method
- Keyword - axis
- Keyword - ignore_index
- Keyword - keys and names
- Keyword - join and verify_integrity
- concat vs append vs merge
10.14 Reshaping Data¶
10.15 GroupBy¶
- GroupBy Object
- Iteration with GroupBy
- get_group Method
- GroupBy Aggregations
- transform Method
- rank Method
- filter Method
- Multi-Level Grouping
10.16 Pivot Tables¶
10.17 Time Series¶
- DatetimeIndex
- Creating Date Ranges
- Parsing Dates
- Time Indexing
- Resampling
- shift and diff
- pct_change Method
10.18 Window Functions¶
10.19 Panel Data¶
- Introduction to Panel Data
- Building Panel DataFrames
- Accessing Panel Data
- Panel Aggregations
- Reshaping Panel Data
10.20 Performance Optimization¶
10.21 Common Pitfalls¶
10.22 Practical Examples¶
- Financial Data Workflow
- SP500 Analysis
- LeetCode Patterns
- LeetCode Series Problems
- LeetCode DataFrame Problems