0

I attempted to exectue the following code:

df = pd.DataFrame()
for file in files:
     if file.endswith('.xls'):
         df = df.append(pd.read_excel(file), ignore_index=True) 
df.head()

but received this error on the 4th command line:Error Code.

However, when I check modules installed I receive:

Pip install list

Why does Jupyter not recognize xlrd as being installed? Thanks for any feedback or help.

codextrmz
  • 27
  • 7

1 Answers1

1

Problem

You are using pip python's default package manager to check a package in python's default install location.

But using Anaconda's virtual environment (which probably jupyter notebook is used with) to run python script which requires packages to be installed in it's own directory via conda package maanger.

Solution

Run this command in Anaconda command pompt:

conda install -c conda-forge xlrd
Anurag Dhadse
  • 1,722
  • 1
  • 13
  • 26
  • 1
    Thanks Anurag! I installed anaconda, launched jupyter notebook, and tried the code again and it worked! I didn't even have to use `conda install` since `xlrd` comes pre-installed. – codextrmz Jun 04 '21 at 04:06
  • 1
    Done! I have another question here (https://stackoverflow.com/questions/67831575/errno-2-no-such-file-or-directory-book10-xls), would love to give you more upvotes if you can help :) – codextrmz Jun 04 '21 at 04:43