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?????
A comma-separated values (csv) file is returned as two-dimensional data structure with labeled axes. Write DataFrame to a comma-separated values (csv) file. Read a comma-separated values (csv) file into DataFrame.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With