Course Content
🎁 Bonus Modules (Integrated Throughout)
Data Analytics
What is Pandas?

Pandas is a Python library used for data manipulation and analysis. It is built on top of NumPy and provides two powerful data structures:

 

  • Series → for 1D labeled data
  • DataFrame → for 2D tabular data

To use it:

import pandas as pd

Pandas Series

What is a Series?

A Series is a one-dimensional labeled array that can hold any data type: integers, floats, strings, etc.

 

Creating a Series:
import pandas as pd

s = pd.Series([10, 20, 30, 40])

 

With Custom Index:
s = pd.Series([10, 20, 30], index=['a', 'b', 'c'])

Accessing Elements:
s['a'] # returns 10
s[1] # returns 20
s[['a','c']] # returns subset

Useful Attributes:

  • s.index → Returns index labels
  • s.values → Returns data values
  • s.dtype → Returns data type

Pandas DataFrame

What is a DataFrame?

A DataFrame is a 2-dimensional table with rows and columns, like an Excel sheet.


Creating a DataFrame:
data = {
'Name': ['Alice', 'Bob', 'Charlie'],
'Age': [25, 30, 22]
}
df = pd.DataFrame(data)

Viewing the DataFrame:
df.head() # first 5 rows
df.tail(2) # last 2 rows
df.shape # returns (rows, columns)
df.columns # returns column names
df.index # returns row index

Accessing Data

Columns
df['Name'] # Returns Series

Rows
df.loc[0] # Label-based indexing
df.iloc[1] # Position-based indexing

Selecting Multiple Columns
df[['Name', 'Age']]

Operations on DataFrames

Filtering Rows:
df[df['Age'] > 23]

Adding a New Column:
df['Salary'] = [50000, 60000, 55000]

Deleting a Column:
df.drop('Salary', axis=1, inplace=True)

Basic Statistics:
df.describe() # Summary statistics
df.mean() # Column-wise mean
 
Concept Benefit
Series Simple structure for 1D data
DataFrame Ideal for structured tabular data
Easy Access Powerful filtering & data manipulation
Built-in Ops Fast summary and transformation

Summary

 
  • Pandas Series is great for handling one-dimensional data with labels.
  • DataFrames are the core tool for reading, manipulating, and analyzing tabular data in Python.
  • Mastering Series and DataFrames makes it easier to work with real-world datasets (CSV, Excel, SQL, etc.)
0% Complete
WhatsApp Icon

Hi Instagram Fam!
Get a FREE Cheat Sheet on System Design.

Hi LinkedIn Fam!
Get a FREE Cheat Sheet on System Design

Loved Our YouTube Videos? Get a FREE Cheat Sheet on System Design.