Seaborn load_dataset

前端 未结 3 766
無奈伤痛
無奈伤痛 2020-12-01 02:48

I am trying to get a grouped boxplot working using Seaborn as per the example

I can get the above example working, however the line:

tips = sns.load_         


        
相关标签:
3条回答
  • 2020-12-01 03:06

    Just to add to 'selwyth's' answer.

    import pandas as pd
    Data=pd.read_csv('Path\to\csv\')
    Data.head(10)
    

    Once you have completed these steps successfully. Now the plotting actually works like this.

    Let's say you want to plot a bar plot.

    sns.barplot(x=Data.Year,y=Data.Salary) //year and salary attributes were present in my dataset.
    

    This actually works with every plotting in seaborn.

    Moreover, we will not be eligible to add our own dataset on Seaborn Git.

    0 讨论(0)
  • 2020-12-01 03:18

    load_dataset looks for online csv files on https://github.com/mwaskom/seaborn-data. Here's the docstring:

    Load a dataset from the online repository (requires internet).

    Parameters


    name : str Name of the dataset (name.csv on https://github.com/mwaskom/seaborn-data). You can obtain list of available datasets using :func:get_dataset_names

    kws : dict, optional Passed to pandas.read_csv

    If you want to modify that online dataset or bring in your own data, you likely have to use pandas. load_dataset actually returns a pandas DataFrame object, which you can confirm with type(tips).

    If you already created your own data in a csv file called, say, tips2.csv, and saved it in the same location as your script, use this (after installing pandas) to load it in:

    import pandas as pd
    
    tips2 = pd.read_csv('tips2.csv')
    
    0 讨论(0)
  • 2020-12-01 03:27

    Download all csv files(zipped) to be used for your example from here.

    Extract the zip file to a local directory and launch your jupyter notebook from the same directory. Run the following commands in jupyter notebook:

    import pandas as pd
    tips = pd.read_csv('seaborn-data-master/tips.csv')
    

    you're good to work with your example now!

    0 讨论(0)
提交回复
热议问题