0

I'm trying to visualize some data with a seaborn plot and the csv file link keeps returning the error '"link.csv" is not one of the example datasets.' What am I doing wrong?

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

df = sns.load_dataset('https://github.com/avocami/Goodreads-project/blob/main/df_goodreads.csv')

sns.jointplot(x=df["avg_rating"], y=df["num_pages"], kind='hex', marginal_kws=dict(bins=30, fill=True))

plt.show()
JE_Muc
  • 5,403
  • 2
  • 26
  • 41
avocami
  • 19
  • 5

1 Answers1

1

Seaborn load_dataset() function is used to load an example dataset from Seaborn library. It is not used to load just any data, just the data specified in their documentation (specifically data that can be found in https://github.com/mwaskom/seaborn-data).

If you want to load your own data, use pandas read_csv() function:

import pandas as pd
df = pd.read_csv('https://github.com/avocami/Goodreads-project/blob/main/df_goodreads.csv')
dm2
  • 4,053
  • 3
  • 17
  • 28
  • 1
    so then, how can i use seaborn to make plots with my own data? And in this case, is it possible to import my data with pd.read_csv and then visualize with seaborn? – avocami Apr 14 '21 at 01:31
  • seaborn load_dataset() returns a pandas.DataFrame object, same as pandas read_csv(), so that's the only difference when you use your own data. Everything else would be the same. – dm2 Apr 14 '21 at 01:33