'NameError: name 'find_stack_level' is not defined when trying to get an xlsx file from a website
I was trying to import a xlsx file from a website using the
requests
packaged and it returned me an strange error. The code and the error below.
import numpy as np
import matplotlib as plt
import pandas as pd
from io import BytesIO
import requests as rq
url = "http://pdet.mte.gov.br/images/Novo_CAGED/Jan2022/3-tabelas.xlsx"
data = rq.get(url).content
caged = pd.read_excel(BytesIO(data))
Traceback (most recent call last):
File "D:\Perfil\Desktop\UFV\trabalho_econometria.py", line 9, in <module>
caged = pd.read_excel(BytesIO(data))
File "C:\Users\Windows\anaconda3\lib\site-packages\pandas\util\_decorators.py", line 299, in wrapper
return func(*args, **kwargs)
File "C:\Users\Windows\anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 344, in read_excel
data = io.parse(
File "C:\Users\Windows\anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 1170, in parse
return self._reader.parse(
File "C:\Users\Windows\anaconda3\lib\site-packages\pandas\io\excel\_base.py", line 504, in parse
if header is not None and is_list_like(header):
NameError: name 'find_stack_level' is not defined
Was trying to read an xlsx sheet from a website and got a strange error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
