Problem with pandas in pycharm

Asked

Viewed 341 times

0

I am using pandas to import an excel file, however, the following error appears:

Cannot find Reference 'read_excel' in 'pandas.py'

import pandas as pd

dados = pd.read_excel(C:/Users/Usuario/Desktop/ArtigosTCC/excel/didaticatech)

Would anyone know why?

Thanks in advance!

  • Everton, good morning! Is this path you are passing within read_excel correct? As you should point to the xlsx file.

2 answers

1

To call a file it is necessary to put the reference as a string (in quotes) and specify the type of the file after its name:

dados = pd.read_excel('C:/Users/Usuario/Desktop/ArtigosTCC/excel/didaticatech.xlsx')
    

0

The python is a language POO, soon he has a concept called polimorfismo, this makes it in case I have a function something(self) I may have the same function something(self) with a parameter amais, ex: something(self, other).

When you call pd.read_excel() he will search the pandas.py by function read_excel(), by default it will ask for a string, in python every string gets between quotation marks or simple, or compound, if you put without strings he does not recognize and seeks in pandas.py some other function with the same name as her that receives parameters other than strings, with this she does not find and returns:

Cannot find Reference 'read_excel' in 'pandas.py'

To solve this, put the path between simple quotes or compound, would be like this:

import pandas as pd

dados = pd.read_excel('C:/Users/Usuario/Desktop/ArtigosTCC/excel/didaticatech')

Or with compound quotes:

import pandas as pd

dados = pd.read_excel("C:/Users/Usuario/Desktop/ArtigosTCC/excel/didaticatech")

Browser other questions tagged

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