I am using pandas in python to read a csv,how do I pass a sheet name to read particular sheet

Viewed 22783

I am using pandas in python to read a .csv file ,how do I pass a sheet name to the function pandas.read_csv() so I can read data from a particular sheet. The code used is :

import pandas as pd 
pd.read_csv("filename.csv") 

How do I pass the sheet name as an argument?????

1 Answers

CSV file is as comma seperated file and so there is no concept of multiple sheets. Try

pd.read_excel('path_to_file.xls', sheetname='Sheet1')

Following link might help.

Related