Skip to content

Instantly share code, notes, and snippets.

@BexTuychiev
Last active July 13, 2020 08:39
Show Gist options
  • Save BexTuychiev/9763af5c286767a485a852eb5556b50f to your computer and use it in GitHub Desktop.
Save BexTuychiev/9763af5c286767a485a852eb5556b50f to your computer and use it in GitHub Desktop.
import pandas as pd
"""Option One""""
# Load file as an ExcelFile object
excel = pd.ExcelFile('financial_sample.xlsx')
# Print out the sheet names
print(excel.sheet_names) # Prints out 'Sheet1' and 'Sheet2'
# Load the two sheets as individual DataFrames
df1 = excel.parse('Sheet1')
df2 = excel.parse(1)
"""Option Two"""
excel = pd.read_excel('financial_sample.xlsx', sheet_name='Sheet1') # Or sheet_name=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment