0

I am using the code given by the python graph website: https://python-graph-gallery.com/110-basic-correlation-matrix-with-seaborn/ A simple code, I was testing the pairplot function. Just did the copy-paste.

The code I used is:

import seaborn as sns
df = sns.load_dataset('https://github.com/mwaskom/seaborn-data/raw/master/iris.csv')
import matplotlib.pyplot as plt

# Basic correlogram
sns.pairplot(df)
sns.plt.show()

And the error is:

HTTPError                                 Traceback (most recent call last)
<ipython-input-1-959108b5285e> in <module>()
      1 import seaborn as sns
----> 2 df = sns.load_dataset('https://github.com/mwaskom/seaborn-data/raw/master/iris.csv')
      3 import matplotlib.pyplot as plt
      4 
      5 # Basic correlogram

7 frames
/usr/lib/python3.6/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
    648 class HTTPDefaultErrorHandler(BaseHandler):
    649     def http_error_default(self, req, fp, code, msg, hdrs):
--> 650         raise HTTPError(req.full_url, code, msg, hdrs, fp)
    651 
    652 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 404: Not Found
Douglas
  • 115
  • 1
  • 1
  • 9

1 Answers1

1

From the tutorial you have mentioned, the code snippet is as follows:

# library & dataset
import seaborn as sns
df = sns.load_dataset('iris')
import matplotlib.pyplot as plt

# Basic correlogram
sns.pairplot(df)
sns.plt.show()

For the load_dataset() function you just need to specify the dataset name.

Quoting directly from this question:

load_dataset looks for online csv files on https://github.com/mwaskom/seaborn-data.

You don't have to specify url, instead just the dataset name available from here

Saurabh P Bhandari
  • 6,014
  • 1
  • 19
  • 50