1
resposta

Erro no método pd.read_html()

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-9-3a29543de4d3> in <module>
----> 1 df_html = pd.read_html('dados_html_1.html')
      2 df_html

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\io\html.py in read_html(io, match, flavor, header, index_col, skiprows, attrs, parse_dates, tupleize_cols, thousands, encoding, decimal, converters, na_values, keep_default_na)
    913                   thousands=thousands, attrs=attrs, encoding=encoding,
    914                   decimal=decimal, converters=converters, na_values=na_values,
--> 915                   keep_default_na=keep_default_na)

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\io\html.py in _parse(flavor, io, match, attrs, encoding, **kwargs)
    737     retained = None
    738     for flav in flavor:
--> 739         parser = _parser_dispatch(flav)
    740         p = parser(io, compiled_match, attrs, encoding)
    741 

~\Anaconda3\envs\alura_pandas\lib\site-packages\pandas\io\html.py in _parser_dispatch(flavor)
    695     else:
    696         if not _HAS_LXML:
--> 697             raise ImportError("lxml not found, please install it")
    698     return _valid_parsers[flavor]
    699 

ImportError: lxml not found, please install it
1 resposta

Bom dia Matheus, tudo bem? Espero que sim!

Instale a biblioteca lxml, usando o seguinte comando em uma célula do Jupyter Notebook ou o que estiver utilizando:

!pip install lxml

Bons estudos!