简体   繁体   中英

BeautifulSoup module error (html parser) while using Seaborn

I am using seaborn to draw a graph.

First I wanted to get the names of the sample dataset.

sns.get_dataset_names()

but this returned an error :

The code that caused this warning is on line 384 of the file C:\Users\pc\Anaconda3\envs\seaborn\lib\site-packages\seaborn\utils.py. To get rid of this warning, pass the additional argument 'features="html.parser"' to the BeautifulSoup constructor

How can I fix this problem? I know I can just ignore this error but I want to get rid of it so that it doesn't show.

To be clear, this is not an error. It is simply a warning. You would have to step into that seaborn function in utils.py to add that in.

def get_dataset_names():
    """Report available example datasets, useful for reporting issues."""
    # delayed import to not demand bs4 unless this function is actually used
    from bs4 import BeautifulSoup
    http = urlopen('https://github.com/mwaskom/seaborn-data/')
    gh_list = BeautifulSoup(http, 'html.parser')  #<-- you'd need to add the parameter here

    return [l.text.replace('.csv', '')
            for l in gh_list.find_all("a", {"class": "js-navigation-open"})
            if l.text.endswith('.csv')]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM