Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Erro ao importar o XLSX

Segui as respostas anteriores de outros alunos para solução, mas obtive sucesso, antes aparecia erro de "xlrd not supported", ai coloquei uns codigos que estavam sendo mostrados nas respostas anteriores e agora o erro atual é " XLRDError: Excel xlsx file; not supported".

XLRDError                                 Traceback (most recent call last)
<ipython-input-7-f600404eb62e> in <module>
----> 1 pd.read_excel('Dados/aluguel.xlsx')

~\anaconda3\envs\alura_pandas\lib\site-packages\pandas\util\_decorators.py in wrapper(*args, **kwargs)
    116                 else:
    117                     kwargs[new_arg_name] = new_arg_value
--> 118             return func(*args, **kwargs)
    119         return wrapper
    120     return _deprecate_kwarg

~\anaconda3\envs\alura_pandas\lib\site-packages\pandas\io\excel.py in read_excel(io, sheet_name, header, skiprows, skip_footer, index_col, names, usecols, parse_dates, date_parser, na_values, thousands, convert_float, converters, dtype, true_values, false_values, engine, squeeze, **kwds)
    228 
    229     if not isinstance(io, ExcelFile):
--> 230         io = ExcelFile(io, engine=engine)
    231 
    232     return io._parse_excel(

~\anaconda3\envs\alura_pandas\lib\site-packages\pandas\io\excel.py in __init__(self, io, **kwds)
    292             self.book = xlrd.open_workbook(file_contents=data)
    293         elif isinstance(self._io, compat.string_types):
--> 294             self.book = xlrd.open_workbook(self._io)
    295         else:
    296             raise ValueError('Must explicitly set engine if not passing in'

~\anaconda3\envs\alura_pandas\lib\site-packages\xlrd\__init__.py in open_workbook(filename, logfile, verbosity, use_mmap, file_contents, encoding_override, formatting_info, on_demand, ragged_rows, ignore_workbook_corruption)
    168     # files that xlrd can parse don't start with the expected signature.
    169     if file_format and file_format != 'xls':
--> 170         raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
    171 
    172     bk = open_workbook_xls(

XLRDError: Excel xlsx file; not supported

O códigos que utilizei foram esses:

conda install -c rmg xlrd

pip install xlrd

conda update -n base -c defaults conda (Quando usei esse código foi atualizado alguma coisa, acho que foi a versão do conda)

conda install xlrd

2 respostas

Segue mais informações abaixo.

# conda environments:
#
base                     C:\Users\Douglas\anaconda3
alura_pandas          *  C:\Users\Douglas\anaconda3\envs\alura_pandas
---------------------------------------------------------------------------------------------------
# packages in environment at C:\Users\Douglas\anaconda3\envs\alura_pandas:
#
# Name                    Version                   Build  Channel

argon2-cffi               20.1.0           py36h2bbff1b_1  
async_generator           1.10             py36h28b3542_0  
attrs                     20.3.0             pyhd3eb1b0_0  
backcall                  0.2.0              pyhd3eb1b0_0  
blas                      1.0                         mkl  
bleach                    3.3.0              pyhd3eb1b0_0  
certifi                   2020.12.5        py36haa95532_0
cffi                      1.14.5           py36hcd4344a_0  
colorama                  0.4.4              pyhd3eb1b0_0  
decorator                 5.0.6              pyhd3eb1b0_0  
defusedxml                0.7.1              pyhd3eb1b0_0  
entrypoints               0.3                      py36_0  
et-xmlfile                1.1.0                    pypi_0    pypi
importlib-metadata        3.10.0           py36ha95532_0 
importlib_metadata        3.10.0               hd3eb1b0_0  
intel-openmp              2020.2                      254  
ipykernel                 5.3.4            py36h5ca1d4c_0  
ipython                   7.16.1           py36h5ca1d4c_0  
ipython_genutils          0.2.0              pyhd3eb1b0_1  
jedi                      0.17.0                   py36_0  
jinja2                    2.11.3             pyhd3eb1b0_0  
jsonschema                3.2.0                      py_2  
jupyter_client            6.1.12             pyhd3eb1b0_0  
jupyter_core              4.7.1            py36haa95532_0  
jupyterlab_pygments       0.1.2                      py_0  
libsodium                 1.0.18               h62dcd97_0  
m2w64-gcc-libgfortran     5.3.0                         6  
m2w64-gcc-libs            5.3.0                         7  
m2w64-gcc-libs-core       5.3.0                         7  
m2w64-gmp                 6.1.0                         2  
m2w64-libwinpthread-git   5.0.0.4634.697f757               2  
markupsafe                1.1.1            py36he774522_0  
mistune                   0.8.4            py36he774522_0  
mkl                       2020.2                      256  
mkl-service               2.3.0            py36h196d8e1_0  
mkl_fft                   1.3.0            py36h46781fe_0  
mkl_random                1.1.1            py36h47e9c7a_0  
msys2-conda-epoch         20160418                      1  
nbclient                  0.5.3              pyhd3eb1b0_0  
nbconvert                 6.0.7                    py36_0  
nbformat                  5.1.3              pyhd3eb1b0_0  
nest-asyncio              1.5.1              pyhd3eb1b0_0  
notebook                  6.3.0            py36haa95532_0  
numpy                     1.19.2           py36hadc3359_0  
numpy-base                1.19.2           py36ha3acd2a_0  
openpyxl                  3.0.7                    pypi_0    pypi
packaging                 20.9               pyhd3eb1b0_0  
pandas                    0.22.0           py36h6538335_0  
pandoc                    2.12                 haa95532_0  
pandocfilters             1.4.3            py36haa95532_1  
parso                     0.8.2              pyhd3eb1b0_0  
pickleshare               0.7.5           pyhd3eb1b0_1003  
pip                       21.0.1           py36haa95532_0  
prometheus_client         0.10.1             pyhd3eb1b0_0  
prompt-toolkit            3.0.17             pyh06a4308_0  
pycparser                 2.20                       py_2  
pygments                  2.8.1              pyhd3eb1b0_0  
pyparsing                 2.4.7              pyhd3eb1b0_0  
pyrsistent                0.17.3           py36he774522_0  
python                    3.6.13               h3758d61_0  
python-dateutil           2.8.1              pyhd3eb1b0_0  
pytz                      2021.1             pyhd3eb1b0_0  
pywin32                   227              py36he774522_1  
pywinpty                  0.5.7                    py36_0  
pyzmq                     20.0.0           py36hd77b12b_1  
send2trash                1.5.0              pyhd3eb1b0_1  
setuptools                52.0.0           py36haa95532_0  
six                       1.15.0           py36haa95532_0  
sqlite                    3.35.4               h2bbff1b_0
solução!

Consegui resolver pelo usando uma dica de um colega, segue a dica abaixo.

https://cursos.alura.com.br/forum/topico-erro-na-importacao-do-xlsx-e-do-html-113288

Resolveu tanto o problema do html e do xlsx.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software