# Pandas DataFrame Cheat Sheet

## Reading Data

```python
import pandas as pd
df = pd.read_csv('file.csv')
df = pd.read_json('file.json')
df.head()      # first 5 rows
df.info()      # column types, null counts
df.describe()  # summary statistics
```

## Selecting & Filtering

```python
df['column']                     # single column
df[['col1', 'col2']]             # multiple columns
df[df['age'] > 18]               # filter rows
df.loc[df['name'] == 'Alice']    # filter by label
df.iloc[0:5]                     # filter by position
```

## Cleaning

```python
df.isnull().sum()                # count missing values per column
df.dropna()                      # drop rows with missing values
df.fillna(0)                     # fill missing values
df.drop_duplicates()             # remove duplicate rows
df.rename(columns={'a': 'b'})    # rename column
```

## Grouping & Aggregating

```python
df.groupby('category')['price'].mean()
df.groupby('category').agg({'price': 'mean', 'qty': 'sum'})
df.sort_values('price', ascending=False)
```

## Combining DataFrames

```python
pd.concat([df1, df2])                       # stack rows
df1.merge(df2, on='id', how='left')         # SQL-style join
```

## Common Mistakes

- Chained assignment (df[df.a > 0]['b'] = 1) warning — .loc[] ကို သုံးပါ
- inplace=True ကို default expect လုပ်ခြင်း — most methods return a new DataFrame by default
