Would anyone like to explain why this came up"Exception has occurred: Missing optional dependency import 'xlrd'"?

Asked

Viewed 70 times

0

I’m using vscode to use pandas in python My code

from IPython.display import display

import pandas as pd

df = pd.read_excel(r"Vendas.xlsx")

display(df)

and I got this information on the line of "df = ..."

Exception has occurred: ImportError
Missing optional dependency 'xlrd'. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
  File "C:\Users\Dell\OneDrive\Documents\Projetos c_py_lua\Projetos PY\Curso python\Intensivão Python 1\vendas.py", line 4, in <module>
    df = pd.read_excel(r"Vendas.xlsx")

someone could help me on that one of the pq I’m not getting to read that file . xlsx?

  • 1

    Install the xlrd that the message goes away.

  • 1

    Pandas needs you to install the dependency. Or pip install xlrd or pip install openpyxl depending on the version of the pandas if I’m not mistaken.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.