1import pandas as pd
2pandas.read_excel(io, sheet_name=0, header=0, names=None,
3 index_col=None, usecols=None,
4 squeeze=False, dtype=None, engine=None,
5 converters=None, true_values=None,
6 false_values=None, skiprows=None,
7 nrows=None, na_values=None,
8 keep_default_na=True, verbose=False,
9 parse_dates=False, date_parser=None,
10 thousands=None, comment=None,
11 skipfooter=0, convert_float=True,
12 mangle_dupe_cols=True, **kwds)
13
14# Example
15pd.read_excel('tmp.xlsx', index_col=0)
1import pandas as pd
2
3df = pd.read_excel (r'Path where the Excel file is stored\File name.xlsx')
1import pandas as pd
2
3# reading in from external file
4movies = pd.read_excel('movies.xls')
5
6# prints first five rows
7movies.head(n=5)
8# prints last five rows
9movies.tail(n=5)
10
11# for excel files w/ multiple sheets
12movies_sheet1 = pd.read_excel(excel_file, sheetname=0)
13movies_sheet2 = pd.read_excel(excel_file, sheetname=1)
14movies_sheet2 = pd.read_excel(excel_file, sheetname='name of third sheet')
15
16# sort by column
17sorted_by_gross = movies.sort_values(['Gross Earnings'], ascending=False)
18
19# exporting to file
20movies.to_excel('output.xlsx')
1#You will need the package openpyxl to use the .read_excel function.
2# pip install openpyxl
3import pandas as pd
4inFile = "Table.xlsx"
5inSheetName = "Sheet1"
6pd.read_excel(inFile, sheet_name = inSheetName)