How do I open a file that is an Excel file for reading in Python?
I"ve opened text files, for example, sometextfile.txt with the reading command. How do I do that for an Excel file?
you can use pandas package as well....
When you are working with an excel file with multiple sheets, you can use:
import pandas as pd
xl = pd.ExcelFile(path + filename)
xl.sheet_names
>>> [u"Sheet1", u"Sheet2", u"Sheet3"]
df = xl.parse("Sheet1")
df.head()
df.head() will print first 5 rows of your Excel file
If you"re working with an Excel file with a single sheet, you can simply use:
import pandas as pd
df = pd.read_excel(path + filename)
print df.head()