πŸš€ Starting My Journey with Pandas – Day 1

We’ve just started learning Pandas, a powerful Python library used for:

  • πŸ“Š Data manipulation

  • πŸ“ˆ Data analysis

  • πŸ“‚ Handling large files (.csv, .xlsx, .json)


🐼 What is Pandas?

The name Pandas comes from:

  • "Panel Data" (a term from statistics)

  • "Python Data Analysis"

Pandas was created by Wes McKinney in 2008. It provides easy-to-use functions for:

  • Analyzing data

  • Cleaning and transforming data

  • Exploring and saving datasets


βš™οΈ Getting Started with Pandas

Step 1: Install and Import

pip install pandas
import pandas as pd

* pd is an alias (shortcut name) that we use instead of typing pandas every time.


πŸ“ Reading Different File Types

df = pd.read_csv("filename.csv", encoding="Latin1")
df = pd.read_excel("filename.xlsx")
df = pd.read_json("filename.json")

print(df)

CSV = Comma Separated Values
XLSX = Excel File
JSON = JavaScript Object Notation


πŸ§ͺ Creating and Saving Data

data = {
    "Name": ["Ram", "Shyam", "Ghanshyam"],
    "Age": [10, 20, 30],
    "City": ["Nagpur", "Mumbai", "Delhi"]
}

df = pd.DataFrame(data)
print(df)

Save the Data

df.to_csv("output.csv", index=False)
df.to_excel("output.xlsx", index=False)
df.to_json("output.json", index=False)

πŸ” Exploring the Dataset

print(df.info())       # Dataset summary
print(df.head())       # First 5 rows
print(df.tail())       # Last 5 rows
print(df.describe())   # Stats summary
print(df.shape)        # Shape as (rows, columns)
print(df.columns)      # List of column names

🎯 Accessing Columns

1. Single Column:

name_col = df["Name"]
print(name_col)

2. Multiple Columns:

multi_col = df[["Name", "Age"]]
print(multi_col)

βœ… Final Thoughts

This is just the beginning of my Pandas journey! πŸš€

Next, I’ll explore how to filter data, handle missing values, and visualize data using Pandas and Matplotlib.

If you’re also learning Pandas or working with Python, feel free to share your experience or tips in the comments! πŸ™Œ


Comments