[go: up one dir, main page]

0% found this document useful (0 votes)
6 views9 pages

Pandas Full Tutorial

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views9 pages

Pandas Full Tutorial

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Comprehensive Pandas Tutorial (Day 1 - Day 8 +

Project)

Day 1 – Basics of Pandas

- Introduction to Pandas: Series & DataFrame


- Creating DataFrames manually & from dictionaries
- Inspecting data: head(), tail(), info(), describe()
- Selecting columns: df['col'] vs df[['col']]
- Selecting rows: loc, iloc
Day 2 – Data Selection & Filtering

- Conditional filtering: df[df['Marks'] > 70]


- loc vs iloc (label-based vs index-based)
- Multiple conditions with & and |
- Boolean masking
Day 3 – Column Operations

- Adding new columns: df['new'] = ...


- Dropping columns: df.drop(columns=['col'])
- Applying functions: apply(), applymap(), map()
- Example: df['Name'] = df['Name'].str.lower()
- Single vs double brackets in column selection
Day 4 – Sorting & Row Operations

- Sorting: df.sort_values(by='Age', ascending=False)


- Adding new rows: df.loc[len(df)] = {...}
- Dropping rows: df.drop(index=[0])
- Creating computed columns: df['Marks+Age'] = df['Marks'] + df['Age']
Day 5 – GroupBy Operations

- Group by single column: df.groupby('Department')['Marks'].mean()


- Group by multiple columns: df.groupby(['Dept','Age']).count()
- Aggregate functions: mean(), max(), std(), count()
- Using lambda in groupby
- Resetting index: reset_index()
Day 6 – Merge, Join, Concat

- pd.merge(df1, df2, on='ID', how='outer')


- Handling NaN: fillna(0)
- pd.concat([df1, df2], axis=1)
- df1.join(df2, how='left')
- Aggregating after merge: groupby().mean()
Day 7 – Pivot, Crosstab, Visualization

- Pivot table: df.pivot_table(values='Marks', index='Dept', columns='Gender')


- Crosstab: pd.crosstab(df['Dept'], df['Gender'])
- normalize argument in crosstab
- Seaborn arguments explained (data, x, y, hue, kind, etc.)
- Visualization: hist, boxplot, lineplot, heatmap
Day 8 – Time Series & Multi-index

- Date parsing: pd.to_datetime()


- Resampling: df.resample('M').mean()
- Rolling windows: df['Close'].rolling(7).mean()
- Multi-indexing: set_index(['Dept','Age'])
- Advanced selection with multi-index
Mini Project – Stock Prices Analysis

- Load dataset: pd.read_csv('stock.csv', parse_dates=['Date'])


- Basic exploration (head, describe)
- Time-series visualization with Matplotlib & Seaborn
- Moving averages (20-day, 50-day)
- Volume trend analysis
- Resampling (monthly averages)
- Multi-indexing example with multiple stocks (if available)

You might also like