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')