How to use Python pandas to read csv file. You must have a Jupyter notebook installed in your laptop or desktop to follow this tutorial. You must also know how to create new project file in Jupyter notebook. I have titanic.csv file installed in my laptop. If you want to follow this tutorial you must download the titanic.csv dataset. Get the dataset from Kaggle.com
My csv file is located at : /Users/invbat/projects/titanic.csv

titanic = pd.read_csv('/users/invbat/projects/titanic.csv')
titanic.head()
Training on How to extract first 8 rows of data records from titanic.csv datasets.
titanic.head(8)
Training on How to extract last 10 rows of data records from titanic.csv datasets.

titanic.tail(10)
Training on How to save csv file to Excel file xlsx
titanic.to_excel('titanic_passengers.xlsx', sheet_name='passengers', index=False)
titanic_passenger = pd.read_excel('titatanic_passengers.xlsx', sheet_name='passengers')
titanic_passenger.head()
Training on how to display the data summary
titanic_passenger.info()
Training on how to display data type of each column name
titanic.dtypes
Training on how to display specific column name

passenger_age_sex = titanic[["Age", "Sex", "Name"]]
passenger_age_sex .tail(10)
Training on how to display age greater than 35

passenger_above_35 = titanic[titanic["Age"] > 35]
passenger_above_35.head()
Training on how to use isin for filtering data

Cabin_class_2_or_3 = titanic[titanic["Pclass"].isin([2,3])]
Cabin_class_2_or_3.head()
Training on how to display anonymous name for privacy

titanic.iloc[0:3, 3] = "anonymous requested for privacy"
titanic.head()
PREVIOUS
NEXT
Copyright 2026
Never Forget Again with IN-V-BAT-AI
INVenting Brain
Assistant Tools
using Artificial Intelligence
(IN-V-BAT-AI)
Since
April 27, 2009