✅ 1. Reading Excel Files with pandas
Example 1: Read an Excel file
Example 2: Read a specific sheet
Example 3: Read multiple sheets into a dictionary
✅ 2. Writing Excel Files with pandas
Example 4: Write a DataFrame to Excel
Example 5: Write to a specific sheet
Example 6: Write multiple DataFrames to multiple sheets
✅ 3. Append (write into existing Excel file)
(pandas cannot directly append; we use ExcelWriter with mode="a")
Example 7: Append a new sheet to existing file
✅ 4. Excel Data Cleaning Examples
Example 8: Drop empty rows
Example 9: Fill missing values
Example 10: Filter rows
✅ 5. Excel → CSV and CSV → Excel
Example 11: Convert Excel → CSV
Example 12: Convert CSV → Excel
π― Summary of Important Functions
| Task | pandas Function |
|---|---|
| Read Excel | pd.read_excel() |
| Write Excel | df.to_excel() |
| Write multiple sheets | pd.ExcelWriter() |
| Read all sheets | sheet_name=None |
| Append new sheet | ExcelWriter(mode="a") |
No comments:
Post a Comment