0

I am a super new user of Python and have been having trouble loading an Excel file to play around with in Python.

I am using Python 3.7 on Windows 10 and have tried things like using the import statement or using pip and pip3 and then install statements. I am so confused on how to do this and no links I've read online are helping.

pip install pandas
pip3 install pandas
import pandas

I just want to upload an Excel file into Python. I'm embarrassed that it's causing me this much stress.

probat
  • 1,422
  • 3
  • 17
  • 33
user2813606
  • 797
  • 2
  • 13
  • 37

1 Answers1

1

first of all you have to import pandas (assuming that is installed, in anaconda usually is already installed as far as i know)

import pandas as pd

to read more sheets in different dataframes (tables)

xls = pd.ExcelFile(path of your file)
df_schema = pd.read_excel(xls, sheet_name=xls.sheet_names) 

df_schema is a dictionary of df in which the key is the name of the sheet and the value is the dataframe.

to read a single sheet the following should work:

xls = pd.ExcelFile(path of your file)
df = pd.read_excel(xls) 
giulio
  • 157
  • 8
  • When I type in import pandas as pd, I get the following message: Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'pandas' – user2813606 Aug 02 '19 at 18:58