Created
December 26, 2019 03:27
-
-
Save leavlzi/d96d816adcdfc1d0c4b2468c8ee6cb2e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Below code will work even if you don't know the exact sheet_names in the excel file. You can try this: | |
import pandas as pd | |
xls = pd.ExcelFile('myexcel.xls') | |
out_df = pd.DataFrame() | |
for sheet in xls.sheet_names: | |
df = pd.read_excel('myexcel.xls', sheet_name=sheet) | |
out_df.append(df) ## This will append rows of one dataframe to another(just like your expected output) | |
print(out_df) | |
## out_df will have data from all the sheets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment