I am using a virtual environment with python version 3.9.9 in VS Code and keep getting the same error even after I pip install lxml. I am able to do it successfully in jupyter notebook using python 3.8.8 but can't figure out how to do it in this new environment. Here is my code:
import pandas as pd
url = 'https://en.wikipedia.org/wiki/Young_Thug'
df = pd.read_html(url)[0]
And here is my error:
>>> import pandas as pd
>>> ml_url = 'https://en.wikipedia.org/wiki/Young_Thug'
>>> ml_df_original = pd.read_html(ml_url)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\main\pyenvs\py39ve\lib\site-packages\pandas\util\_decorators.py", line 311, in wrapper
return func(*args, **kwargs)
File "C:\Users\main\pyenvs\py39ve\lib\site-packages\pandas\io\html.py", line 1113, in read_html
return _parse(
File "C:\Users\main\pyenvs\py39ve\lib\site-packages\pandas\io\html.py", line 915, in _parse
parser = _parser_dispatch(flav)
File "C:\Users\main\pyenvs\py39ve\lib\site-packages\pandas\io\html.py", line 872, in _parser_dispatch
raise ImportError("lxml not found, please install it")
ImportError: lxml not found, please install it
I tried all of the suggestions on this page and nothing worked. Thanks to anyone who can help.