# Pandas in Python – Simple Full Notes
## 1. What is Pandas?
Pandas is a powerful open■source Python library used for data analysis and data manipulation. It
provides easy■to■use tools for working with structured data such as tables, spreadsheets, and
databases.
---
## 2. Key Features of Pandas
- Fast and flexible data structures: **Series** and **DataFrame**
- Easy loading, cleaning, and transforming data
- Supports Excel, CSV, SQL, JSON and many more formats
- Built■in statistical, filtering, and grouping methods
- Excellent for real■world data analysis and machine learning workflows
---
## 3. Pandas Data Structures
### **Series**
- One■dimensional labeled array
- Similar to a column in a spreadsheet
- Example: `[Link]([1,2,3])`
### **DataFrame**
- Two■dimensional table of rows and columns
- Similar to Excel sheet or SQL table
- Example: `[Link]({'A':[1,2], 'B':[3,4]})`
---
## 4. Reading Data
### From CSV
`df = pd.read_csv('[Link]')`
### From Excel
`df = pd.read_excel('[Link]')`
### From SQL
`df = pd.read_sql(query, connection)`
---
## 5. Viewing Data
- `[Link]()` → first 5 rows
- `[Link]()` → last 5 rows
- `[Link]()` → structure of data
- `[Link]()` → summary statistics
---
## 6. Selecting and Accessing Data
- Selecting a column: `df['column']`
- Selecting rows with conditions: `df[df['Age'] > 30]`
- Using loc: `[Link][row_label, column_label]`
- Using iloc: `[Link][row_index, column_index]`
---
## 7. Data Cleaning
- Removing missing values: `[Link]()`
- Filling missing values: `[Link](value)`
- Removing duplicates: `df.drop_duplicates()`
- Renaming columns: `[Link](columns={'old':'new'})`
---
## 8. Data Manipulation
- Adding new columns: `df['new'] = ...`
- Deleting columns: `[Link]('col', axis=1)`
- Sorting: `df.sort_values('Age')`
- Filtering: `df[df['Salary'] > 50000]`
---
## 9. Grouping & Aggregation
Pandas makes it easy to group data.
Example:
`[Link]('Department')['Salary'].mean()`
---
## 10. Merging and Joining Data
- `[Link](df1, df2, on='id')` → SQL■style joins
- `[Link](df2)` → join by index
- `[Link]([df1, df2])` → append rows or columns
---
## 11. Exporting Data
- To CSV: `df.to_csv('[Link]')`
- To Excel: `df.to_excel('[Link]')`
- To JSON: `df.to_json('[Link]')`
---
## 12. Plotting with Pandas
Pandas supports built■in plotting using Matplotlib:
`df['Sales'].plot()`
`[Link](kind='bar')`
---
## 13. Why Use Pandas?
- Easy to learn
- Works perfectly with NumPy, Matplotlib, and Scikit■learn
- Industry standard for data analysis
- Used in ML, AI, data science, and business analytics
---
## 14. Summary
Pandas simplifies:
- Loading data
- Cleaning data
- Exploring data
- Analyzing data
- Preparing data for machine learning
It is one of the most essential libraries for anyone working with data.