0

I used below code to use a dataset from my own github account(Disclaimer: Dataset used from some other location & name modified to keep in my github account). import seaborn as sns

df = sns.load_dataset('https://github.com/vishalkrsinha/Python/blob/Data/FiveYearData.csv')

But, it gives me the error as below(Traceback). I understand load_dataset() function looks for online dataset. I also tried using physical path (as online path was giving error) but could not succeed. Kindly suggest the solution.

Traceback (most recent call last): File "D:/DataVisualization/Test.py", line 10, in df = sns.load_dataset('https://github.com/vishalkrsinha/Python/blob/Data/FiveYearData.csv') File "C:\Users\user1\AppData\Roaming\Python\Python37\site-packages\seaborn\utils.py", line 428, in load_dataset urlretrieve(full_path, cache_path) File "C:\Users\user1\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 247, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "C:\Users\user1\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 222, in urlopen return opener.open(url, data, timeout) File "C:\Users\user1\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 531, in open response = meth(req, response) File "C:\Users\user1\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 641, in http_response 'http', request, response, code, msg, hdrs) File "C:\Users\user1\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 569, in error return self._call_chain(*args) File "C:\Users\user1\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 503, in _call_chain result = func(*args) File "C:\Users\user1\AppData\Local\Programs\Python\Python37\lib\urllib\request.py", line 649, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 404: Not Found

Process finished with exit code 1

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
WpfBee
  • 2,837
  • 6
  • 23
  • 29
  • It could be a duplicate question, but I m still looking for the solution. Can someone please help me? – WpfBee Jul 15 '19 at 14:24
  • 1
    Got the solution by debugging. Short explanation: The second parameter of load_dataset() is 'cache' that has default boolean value as 'True'. So, if dataset not found online then the function looks into below physical path: C:\Users\user1\seaborn-data This path should have your dataset if not found online: df = sns.load_dataset('FiveYearData') We can also provide different physical path for dataset through third parameter (data_home) as below: df = sns.load_dataset('FiveYearData',data_home=os.path.dirname(os.path.abspath("FiveYearData"))) – WpfBee Jul 16 '19 at 07:14

0 Answers0