Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

[Dúvida] Erro ao ler arquivo Excel

Fiz o passo a passo, mas quando vou ler um arquivo aparece um erro. Alguém sabe o porque?

df_xlsx = pd.read_excel('dados/aluguel.xlsx') df_xlsx


XLRDError Traceback (most recent call last) in ----> 1 df_xlsx = pd.read_excel('dados/aluguel.xlsx') 2 df_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 deprecatekwarg

~\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.parseexcel(

~\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.stringtypes): --> 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 openworkbook(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

1 resposta
solução!

Camarada,

Vi seu erro, e fui ver se conseguiria te ajudar em algo. Porém ao tentar executar o código aqui inicialmente obtive o mesmo erro, mas consegui sana-lo da seguinte forma:

1º No prompt de comando digitei: conda install -c anaconda xlrd

2º Reiniciei o jupyter e o anaconda.

Veja se funciona ai.

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