Ravindra BagaleCourses & study guides

5. pandas DataFrames and Series

5.3 Read CSV and Excel

Save this as data/blinkit_sample.csv (or create from notebook):

df.to_csv("data/blinkit_sample.csv", index=False)
df2 = pd.read_csv("data/blinkit_sample.csv")
df2.head()

Excel (needs openpyxl):

df.to_excel("data/blinkit_sample.xlsx", index=False)
df3 = pd.read_excel("data/blinkit_sample.xlsx")
Method Use
read_csv Most class exports
read_excel .xlsx from ops teams
to_csv / to_excel Save cleaned output

Practice task

Add two more fictional rows (Solapur Delivered, Nagpur Returned) to the DataFrame. Save CSV, read it back, and confirm shape is (5, 7).