Reputation: 1
I would like to know why the code below works fine when executed from Python interpreter but it returns no value when I "pack" it into the file.
import os
import pandas as pd
getFile = (input('\nEnter Excel file name: ')).lower()
getTab = (input('\nEnter tab name: ')).lower()
fileName = os.path.join(os.getcwd() + '\\' + getFile)
pd.read_excel(fileName, sheet_name=getTab, header=None)
Is there any reason I can't run this code from someFile.py? What I do wrong? Many thanks for your kind help. Please, be forgiving, I'm not a professional or skilful coder.
Upvotes: 0
Views: 584
Reputation: 8033
You have to give a name to the dataframe into which the data should be read. Try the code below
df= pd.read_excel(fileName, sheet_name=getTab, header=None)
If you are working in Jupyter notebook, the below line will print the dataframe
df
Upvotes: 1