Giter VIP home page Giter VIP logo

seaborn-data's Introduction

seaborn-data

Data repository for seaborn examples.

⚠️ This is not a general-purpose data archive ⚠️

This repository exists only to provide a convenient target for the seaborn.load_dataset function to download sample datasets from. Its existence makes it easy to document seaborn without confusing things by spending time loading and munging data. The datasets may change or be removed at any time if they are no longer useful for the seaborn documentation. Some of the datasets have also been modifed from their canonical sources.

Data sources

A partial list of where these datasets originate from.

Dataset paths See #33 for context
  • /mwaskom/seaborn-data/blob/master/anagrams.csv
  • /mwaskom/seaborn-data/blob/master/anscombe.csv
  • /mwaskom/seaborn-data/blob/master/attention.csv
  • /mwaskom/seaborn-data/blob/master/brain_networks.csv
  • /mwaskom/seaborn-data/blob/master/car_crashes.csv
  • /mwaskom/seaborn-data/blob/master/diamonds.csv
  • /mwaskom/seaborn-data/blob/master/dots.csv
  • /mwaskom/seaborn-data/blob/master/dowjones.csv
  • /mwaskom/seaborn-data/blob/master/exercise.csv
  • /mwaskom/seaborn-data/blob/master/flights.csv
  • /mwaskom/seaborn-data/blob/master/fmri.csv
  • /mwaskom/seaborn-data/blob/master/geyser.csv
  • /mwaskom/seaborn-data/blob/master/glue.csv
  • /mwaskom/seaborn-data/blob/master/healthexp.csv
  • /mwaskom/seaborn-data/blob/master/iris.csv
  • /mwaskom/seaborn-data/blob/master/mpg.csv
  • /mwaskom/seaborn-data/blob/master/penguins.csv
  • /mwaskom/seaborn-data/blob/master/planets.csv
  • /mwaskom/seaborn-data/blob/master/seaice.csv
  • /mwaskom/seaborn-data/blob/master/taxis.csv
  • /mwaskom/seaborn-data/blob/master/tips.csv
  • /mwaskom/seaborn-data/blob/master/titanic.csv

seaborn-data's People

Contributors

koenvo avatar mwaskom avatar trenton3983 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

seaborn-data's Issues

load_dataset is not working, getting the below error, please assist.

TimeoutError Traceback (most recent call last)
~\anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1345 try:
-> 1346 h.request(req.get_method(), req.selector, req.data, headers,
1347 encode_chunked=req.has_header('Transfer-encoding'))

~\anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1278 """Send a complete request to the server."""
-> 1279 self._send_request(method, url, body, headers, encode_chunked)
1280

~\anaconda3\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1324 body = _encode(body, 'body')
-> 1325 self.endheaders(body, encode_chunked=encode_chunked)
1326

~\anaconda3\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1273 raise CannotSendHeader()
-> 1274 self._send_output(message_body, encode_chunked=encode_chunked)
1275

~\anaconda3\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1033 del self._buffer[:]
-> 1034 self.send(msg)
1035

~\anaconda3\lib\http\client.py in send(self, data)
973 if self.auto_open:
--> 974 self.connect()
975 else:

~\anaconda3\lib\http\client.py in connect(self)
1440
-> 1441 super().connect()
1442

~\anaconda3\lib\http\client.py in connect(self)
944 """Connect to the host and port specified in init."""
--> 945 self.sock = self._create_connection(
946 (self.host,self.port), self.timeout, self.source_address)

~\anaconda3\lib\socket.py in create_connection(address, timeout, source_address)
843 try:
--> 844 raise err
845 finally:

~\anaconda3\lib\socket.py in create_connection(address, timeout, source_address)
831 sock.bind(source_address)
--> 832 sock.connect(sa)
833 # Break explicitly a reference cycle

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12220/2927704185.py in
1 import seaborn as sn
----> 2 iris = sn.load_dataset('iris')

~\anaconda3\lib\site-packages\seaborn\utils.py in load_dataset(name, cache, data_home, **kws)
594 if name not in get_dataset_names():
595 raise ValueError(f"'{name}' is not one of the example datasets.")
--> 596 urlretrieve(url, cache_path)
597 full_path = cache_path
598 else:

~\anaconda3\lib\urllib\request.py in urlretrieve(url, filename, reporthook, data)
237 url_type, path = _splittype(url)
238
--> 239 with contextlib.closing(urlopen(url, data)) as fp:
240 headers = fp.info()
241

~\anaconda3\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
212 else:
213 opener = _opener
--> 214 return opener.open(url, data, timeout)
215
216 def install_opener(opener):

~\anaconda3\lib\urllib\request.py in open(self, fullurl, data, timeout)
515
516 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 517 response = self._open(req, data)
518
519 # post-process response

~\anaconda3\lib\urllib\request.py in _open(self, req, data)
532
533 protocol = req.type
--> 534 result = self._call_chain(self.handle_open, protocol, protocol +
535 '_open', req)
536 if result:

~\anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
492 for handler in handlers:
493 func = getattr(handler, meth_name)
--> 494 result = func(*args)
495 if result is not None:
496 return result

~\anaconda3\lib\urllib\request.py in https_open(self, req)
1387
1388 def https_open(self, req):
-> 1389 return self.do_open(http.client.HTTPSConnection, req,
1390 context=self._context, check_hostname=self._check_hostname)
1391

~\anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1347 encode_chunked=req.has_header('Transfer-encoding'))
1348 except OSError as err: # timeout error
-> 1349 raise URLError(err)
1350 r = h.getresponse()
1351 except:

URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

SSL: CERTIFICATE_VERIFY_FAILED

import seaborn as sns
df = sns.load_dataset('iris')
  • Python 3.6.5
  • seaborn (0.9.0)

stacktrace:

SSLError                                  Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1317                 h.request(req.get_method(), req.selector, req.data, headers,
-> 1318                           encode_chunked=req.has_header('Transfer-encoding'))
   1319             except OSError as err: # timeout error

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in request(self, method, url, body, headers, encode_chunked)
   1238         """Send a complete request to the server."""
-> 1239         self._send_request(method, url, body, headers, encode_chunked)
   1240 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
   1284             body = _encode(body, 'body')
-> 1285         self.endheaders(body, encode_chunked=encode_chunked)
   1286 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in endheaders(self, message_body, encode_chunked)
   1233             raise CannotSendHeader()
-> 1234         self._send_output(message_body, encode_chunked=encode_chunked)
   1235 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in _send_output(self, message_body, encode_chunked)
   1025         del self._buffer[:]
-> 1026         self.send(msg)
   1027 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in send(self, data)
    963             if self.auto_open:
--> 964                 self.connect()
    965             else:

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in connect(self)
   1399             self.sock = self._context.wrap_socket(self.sock,
-> 1400                                                   server_hostname=server_hostname)
   1401             if not self._context.check_hostname and self._check_hostname:

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    406                          server_hostname=server_hostname,
--> 407                          _context=self, _session=session)
    408 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in __init__(self, sock, keyfile, certfile, server_side, cert_reqs, ssl_version, ca_certs, do_handshake_on_connect, family, type, proto, fileno, suppress_ragged_eofs, npn_protocols, ciphers, server_hostname, _context, _session)
    813                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 814                     self.do_handshake()
    815 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in do_handshake(self, block)
   1067                 self.settimeout(None)
-> 1068             self._sslobj.do_handshake()
   1069         finally:

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in do_handshake(self)
    688         """Start the SSL/TLS handshake."""
--> 689         self._sslobj.do_handshake()
    690         if self.context.check_hostname:

SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
<ipython-input-3-0eecab881fa3> in <module>
      1 import seaborn as sns
      2 
----> 3 df = sns.load_dataset('iris')

~/test-voila/.venv/lib/python3.6/site-packages/seaborn/utils.py in load_dataset(name, cache, data_home, **kws)
    426                                   os.path.basename(full_path))
    427         if not os.path.exists(cache_path):
--> 428             urlretrieve(full_path, cache_path)
    429         full_path = cache_path
    430 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in urlretrieve(url, filename, reporthook, data)
    246     url_type, path = splittype(url)
    247 
--> 248     with contextlib.closing(urlopen(url, data)) as fp:
    249         headers = fp.info()
    250 

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
    221     else:
    222         opener = _opener
--> 223     return opener.open(url, data, timeout)
    224 
    225 def install_opener(opener):

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in open(self, fullurl, data, timeout)
    524             req = meth(req)
    525 
--> 526         response = self._open(req, data)
    527 
    528         # post-process response

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in _open(self, req, data)
    542         protocol = req.type
    543         result = self._call_chain(self.handle_open, protocol, protocol +
--> 544                                   '_open', req)
    545         if result:
    546             return result

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
    502         for handler in handlers:
    503             func = getattr(handler, meth_name)
--> 504             result = func(*args)
    505             if result is not None:
    506                 return result

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in https_open(self, req)
   1359         def https_open(self, req):
   1360             return self.do_open(http.client.HTTPSConnection, req,
-> 1361                 context=self._context, check_hostname=self._check_hostname)
   1362 
   1363         https_request = AbstractHTTPHandler.do_request_

/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
   1318                           encode_chunked=req.has_header('Transfer-encoding'))
   1319             except OSError as err: # timeout error
-> 1320                 raise URLError(err)
   1321             r = h.getresponse()
   1322         except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>

Dataset descriptions.

Are these datasets described somewhere? What is the data, what does each column mean, etc?

Publish on GitHub pages?

Thanks for these datasets!

Elevator Pitch

It would be lovely if the data sets were available from a GitHub Pages site.

Motivation

Pages have fewer CORS headers, requirements, etc. so might be accessible to more folks/environments.

The direct motivation is accessing the examples from pyodide (specifically jupyterlite).

Design Ideas

The Pages config itself (using the default branch as the pages source) might only need

  • a button press in the GitHub UI
  • a (built) index.html to resolve as https://mwaskom.github.io/seaborn-data/

Future Work

  • A related change would be potentially preferring the pages URL
    • or making it an argument to load_dataset (and therefore) get_dataset_names.
  • As an aside: the seaborn documentation site could also host a live pyodide demo/playground to augment the existing gallery, and the data sets could be sourced from there.

I cannot use the datasets in seaborn

code: import seaborn as sns
planets = sns.load_dataset('data/planets')
planets.shape

after type this, I got the error


EmptyDataError Traceback (most recent call last)
in
1 import seaborn as sns
----> 2 planets = sns.load_dataset('data/planets')
3 planets.shape

~\Anaconda3\lib\site-packages\seaborn\utils.py in load_dataset(name, cache, data_home, **kws)
429 full_path = cache_path
430
--> 431 df = pd.read_csv(full_path, **kws)
432 if df.iloc[-1].isnull().all():
433 df = df.iloc[:-1]

~\Anaconda3\lib\site-packages\pandas\io\parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)
700 skip_blank_lines=skip_blank_lines)
701
--> 702 return _read(filepath_or_buffer, kwds)
703
704 parser_f.name = name

~\Anaconda3\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds)
427
428 # Create the parser.
--> 429 parser = TextFileReader(filepath_or_buffer, **kwds)
430
431 if chunksize or iterator:

~\Anaconda3\lib\site-packages\pandas\io\parsers.py in init(self, f, engine, **kwds)
893 self.options['has_index_names'] = kwds['has_index_names']
894
--> 895 self._make_engine(self.engine)
896
897 def close(self):

~\Anaconda3\lib\site-packages\pandas\io\parsers.py in _make_engine(self, engine)
1120 def _make_engine(self, engine='c'):
1121 if engine == 'c':
-> 1122 self._engine = CParserWrapper(self.f, **self.options)
1123 else:
1124 if engine == 'python':

~\Anaconda3\lib\site-packages\pandas\io\parsers.py in init(self, src, **kwds)
1851 kwds['usecols'] = self.usecols
1852
-> 1853 self._reader = parsers.TextReader(src, **kwds)
1854 self.unnamed_cols = self._reader.unnamed_cols
1855

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.cinit()

EmptyDataError: No columns to parse from file

Can't access to dataset.

Hi, I have a problem to get the data from github.

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)>


SSLCertVerificationError Traceback (most recent call last)
//anaconda3/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1316 h.request(req.get_method(), req.selector, req.data, headers,
-> 1317 encode_chunked=req.has_header('Transfer-encoding'))
1318 except OSError as err: # timeout error

//anaconda3/lib/python3.7/http/client.py in request(self, method, url, body, headers, encode_chunked)
1228 """Send a complete request to the server."""
-> 1229 self._send_request(method, url, body, headers, encode_chunked)
1230

//anaconda3/lib/python3.7/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1274 body = _encode(body, 'body')
-> 1275 self.endheaders(body, encode_chunked=encode_chunked)
1276

//anaconda3/lib/python3.7/http/client.py in endheaders(self, message_body, encode_chunked)
1223 raise CannotSendHeader()
-> 1224 self._send_output(message_body, encode_chunked=encode_chunked)
1225

//anaconda3/lib/python3.7/http/client.py in _send_output(self, message_body, encode_chunked)
1015 del self._buffer[:]
-> 1016 self.send(msg)
1017

//anaconda3/lib/python3.7/http/client.py in send(self, data)
955 if self.auto_open:
--> 956 self.connect()
957 else:

//anaconda3/lib/python3.7/http/client.py in connect(self)
1391 self.sock = self._context.wrap_socket(self.sock,
-> 1392 server_hostname=server_hostname)
1393

//anaconda3/lib/python3.7/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
411 context=self,
--> 412 session=session
413 )

//anaconda3/lib/python3.7/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
852 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 853 self.do_handshake()
854 except (OSError, ValueError):

//anaconda3/lib/python3.7/ssl.py in do_handshake(self, block)
1116 self.settimeout(None)
-> 1117 self._sslobj.do_handshake()
1118 finally:

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last)
in
----> 1 ax = stats_viz.anscombes_quartet()

~/datascience/data_science_intro/Hands-On-Data-Analysis-with-Pandas/ch_01/stats_viz.py in anscombes_quartet()
20
21 # get data
---> 22 anscombe = sns.load_dataset('anscombe').groupby('dataset')
23
24 # define subplots and titles

~/datascience/data_science_intro/Hands-On-Data-Analysis-with-Pandas/book_env/lib/python3.7/site-packages/seaborn/utils.py in load_dataset(name, cache, data_home, **kws)
426 os.path.basename(full_path))
427 if not os.path.exists(cache_path):
--> 428 urlretrieve(full_path, cache_path)
429 full_path = cache_path
430

//anaconda3/lib/python3.7/urllib/request.py in urlretrieve(url, filename, reporthook, data)
245 url_type, path = splittype(url)
246
--> 247 with contextlib.closing(urlopen(url, data)) as fp:
248 headers = fp.info()
249

//anaconda3/lib/python3.7/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
--> 222 return opener.open(url, data, timeout)
223
224 def install_opener(opener):

//anaconda3/lib/python3.7/urllib/request.py in open(self, fullurl, data, timeout)
523 req = meth(req)
524
--> 525 response = self._open(req, data)
526
527 # post-process response

//anaconda3/lib/python3.7/urllib/request.py in _open(self, req, data)
541 protocol = req.type
542 result = self._call_chain(self.handle_open, protocol, protocol +
--> 543 '_open', req)
544 if result:
545 return result

//anaconda3/lib/python3.7/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
501 for handler in handlers:
502 func = getattr(handler, meth_name)
--> 503 result = func(*args)
504 if result is not None:
505 return result

//anaconda3/lib/python3.7/urllib/request.py in https_open(self, req)
1358 def https_open(self, req):
1359 return self.do_open(http.client.HTTPSConnection, req,
-> 1360 context=self._context, check_hostname=self.check_hostname)
1361
1362 https_request = AbstractHTTPHandler.do_request

//anaconda3/lib/python3.7/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1317 encode_chunked=req.has_header('Transfer-encoding'))
1318 except OSError as err: # timeout error
-> 1319 raise URLError(err)
1320 r = h.getresponse()
1321 except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)>

This an issue related to github?

Thanks

Load_dataset is not working for me. getting the below error.

TimeoutError Traceback (most recent call last)
~\anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1345 try:
-> 1346 h.request(req.get_method(), req.selector, req.data, headers,
1347 encode_chunked=req.has_header('Transfer-encoding'))

~\anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1278 """Send a complete request to the server."""
-> 1279 self._send_request(method, url, body, headers, encode_chunked)
1280

~\anaconda3\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1324 body = _encode(body, 'body')
-> 1325 self.endheaders(body, encode_chunked=encode_chunked)
1326

~\anaconda3\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1273 raise CannotSendHeader()
-> 1274 self._send_output(message_body, encode_chunked=encode_chunked)
1275

~\anaconda3\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1033 del self._buffer[:]
-> 1034 self.send(msg)
1035

~\anaconda3\lib\http\client.py in send(self, data)
973 if self.auto_open:
--> 974 self.connect()
975 else:

~\anaconda3\lib\http\client.py in connect(self)
1440
-> 1441 super().connect()
1442

~\anaconda3\lib\http\client.py in connect(self)
944 """Connect to the host and port specified in init."""
--> 945 self.sock = self._create_connection(
946 (self.host,self.port), self.timeout, self.source_address)

~\anaconda3\lib\socket.py in create_connection(address, timeout, source_address)
843 try:
--> 844 raise err
845 finally:

~\anaconda3\lib\socket.py in create_connection(address, timeout, source_address)
831 sock.bind(source_address)
--> 832 sock.connect(sa)
833 # Break explicitly a reference cycle

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12220/2927704185.py in
1 import seaborn as sn
----> 2 iris = sn.load_dataset('iris')

~\anaconda3\lib\site-packages\seaborn\utils.py in load_dataset(name, cache, data_home, **kws)
594 if name not in get_dataset_names():
595 raise ValueError(f"'{name}' is not one of the example datasets.")
--> 596 urlretrieve(url, cache_path)
597 full_path = cache_path
598 else:

~\anaconda3\lib\urllib\request.py in urlretrieve(url, filename, reporthook, data)
237 url_type, path = _splittype(url)
238
--> 239 with contextlib.closing(urlopen(url, data)) as fp:
240 headers = fp.info()
241

~\anaconda3\lib\urllib\request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
212 else:
213 opener = _opener
--> 214 return opener.open(url, data, timeout)
215
216 def install_opener(opener):

~\anaconda3\lib\urllib\request.py in open(self, fullurl, data, timeout)
515
516 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 517 response = self._open(req, data)
518
519 # post-process response

~\anaconda3\lib\urllib\request.py in _open(self, req, data)
532
533 protocol = req.type
--> 534 result = self._call_chain(self.handle_open, protocol, protocol +
535 '_open', req)
536 if result:

~\anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
492 for handler in handlers:
493 func = getattr(handler, meth_name)
--> 494 result = func(*args)
495 if result is not None:
496 return result

~\anaconda3\lib\urllib\request.py in https_open(self, req)
1387
1388 def https_open(self, req):
-> 1389 return self.do_open(http.client.HTTPSConnection, req,
1390 context=self._context, check_hostname=self._check_hostname)
1391

~\anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1347 encode_chunked=req.has_header('Transfer-encoding'))
1348 except OSError as err: # timeout error
-> 1349 raise URLError(err)
1350 r = h.getresponse()
1351 except:

URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

URL error

I tried loading the tips dataset using anaconda. However, I got this error. How can I solve this please?

TimeoutError Traceback (most recent call last)
File ~\anaconda3\Lib\urllib\request.py:1348, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args)
1347 try:
-> 1348 h.request(req.get_method(), req.selector, req.data, headers,
1349 encode_chunked=req.has_header('Transfer-encoding'))
1350 except OSError as err: # timeout error

File ~\anaconda3\Lib\http\client.py:1294, in HTTPConnection.request(self, method, url, body, headers, encode_chunked)
1293 """Send a complete request to the server."""
-> 1294 self._send_request(method, url, body, headers, encode_chunked)

File ~\anaconda3\Lib\http\client.py:1340, in HTTPConnection._send_request(self, method, url, body, headers, encode_chunked)
1339 body = _encode(body, 'body')
-> 1340 self.endheaders(body, encode_chunked=encode_chunked)

File ~\anaconda3\Lib\http\client.py:1289, in HTTPConnection.endheaders(self, message_body, encode_chunked)
1288 raise CannotSendHeader()
-> 1289 self._send_output(message_body, encode_chunked=encode_chunked)

File ~\anaconda3\Lib\http\client.py:1048, in HTTPConnection._send_output(self, message_body, encode_chunked)
1047 del self._buffer[:]
-> 1048 self.send(msg)
1050 if message_body is not None:
1051
1052 # create a consistent interface to message_body

File ~\anaconda3\Lib\http\client.py:986, in HTTPConnection.send(self, data)
985 if self.auto_open:
--> 986 self.connect()
987 else:

File ~\anaconda3\Lib\http\client.py:1466, in HTTPSConnection.connect(self)
1464 server_hostname = self.host
-> 1466 self.sock = self._context.wrap_socket(self.sock,
1467 server_hostname=server_hostname)

File ~\anaconda3\Lib\ssl.py:517, in SSLContext.wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
511 def wrap_socket(self, sock, server_side=False,
512 do_handshake_on_connect=True,
513 suppress_ragged_eofs=True,
514 server_hostname=None, session=None):
515 # SSLSocket class handles server_hostname encoding before it calls
516 # ctx._wrap_socket()
--> 517 return self.sslsocket_class._create(
518 sock=sock,
519 server_side=server_side,
520 do_handshake_on_connect=do_handshake_on_connect,
521 suppress_ragged_eofs=suppress_ragged_eofs,
522 server_hostname=server_hostname,
523 context=self,
524 session=session
525 )

File ~\anaconda3\Lib\ssl.py:1108, in SSLSocket._create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1107 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1108 self.do_handshake()
1109 except (OSError, ValueError):

File ~\anaconda3\Lib\ssl.py:1383, in SSLSocket.do_handshake(self, block)
1382 self.settimeout(None)
-> 1383 self._sslobj.do_handshake()
1384 finally:

TimeoutError: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

During handling of the above exception, another exception occurred:

URLError Traceback (most recent call last)
Cell In[9], line 1
----> 1 sns.load_dataset('tips')

File ~\anaconda3\Lib\site-packages\seaborn\utils.py:588, in load_dataset(name, cache, data_home, **kws)
586 if name not in get_dataset_names():
587 raise ValueError(f"'{name}' is not one of the example datasets.")
--> 588 urlretrieve(url, cache_path)
589 full_path = cache_path
590 else:

File ~\anaconda3\Lib\urllib\request.py:241, in urlretrieve(url, filename, reporthook, data)
224 """
225 Retrieve a URL into a temporary location on disk.
226
(...)
237 data file as well as the resulting HTTPMessage object.
238 """
239 url_type, path = _splittype(url)
--> 241 with contextlib.closing(urlopen(url, data)) as fp:
242 headers = fp.info()
244 # Just return the local path and the "headers" for file://
245 # URLs. No sense in performing a copy unless requested.

File ~\anaconda3\Lib\urllib\request.py:216, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
214 else:
215 opener = _opener
--> 216 return opener.open(url, data, timeout)

File ~\anaconda3\Lib\urllib\request.py:519, in OpenerDirector.open(self, fullurl, data, timeout)
516 req = meth(req)
518 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 519 response = self._open(req, data)
521 # post-process response
522 meth_name = protocol+"_response"

File ~\anaconda3\Lib\urllib\request.py:536, in OpenerDirector._open(self, req, data)
533 return result
535 protocol = req.type
--> 536 result = self._call_chain(self.handle_open, protocol, protocol +
537 '_open', req)
538 if result:
539 return result

File ~\anaconda3\Lib\urllib\request.py:496, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
494 for handler in handlers:
495 func = getattr(handler, meth_name)
--> 496 result = func(*args)
497 if result is not None:
498 return result

File ~\anaconda3\Lib\urllib\request.py:1391, in HTTPSHandler.https_open(self, req)
1390 def https_open(self, req):
-> 1391 return self.do_open(http.client.HTTPSConnection, req,
1392 context=self._context, check_hostname=self._check_hostname)

File ~\anaconda3\Lib\urllib\request.py:1351, in AbstractHTTPHandler.do_open(self, http_class, req, **http_conn_args)
1348 h.request(req.get_method(), req.selector, req.data, headers,
1349 encode_chunked=req.has_header('Transfer-encoding'))
1350 except OSError as err: # timeout error
-> 1351 raise URLError(err)
1352 r = h.getresponse()
1353 except:

URLError: <urlopen error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

ValueError: '{name}' is not one of the example datasets.

Hi!

I tried the load_dataset func but, I got "ValueError: 'tips' is not one of the example datasets." error. First, I thought be issue with my computer, so I tried colab, but the error is still there.

image

You can check python version and seaborn version here
image

Seaborn pairplot supresses error messages (correlations with NaN/inf values)

I have discovered this strange behaviour. Imagine you have a data set, you want to plot all pairplots and annotate them with correlation coefficients. Assume there is a cell which has a NaN value (or inf). Then the following code outputs pairplot with no annotations:

import numpy as np
import pandas as pd
import seaborn as sns
from scipy import stats

def corrfunc(x, y, ax=None, **kws):
    """Plot the correlation coefficient in the top left hand corner of a plot."""
    r, _ = stats.pearsonr(x, y)
    ax = ax or plt.gca()
    ax.annotate(f'ρ = {r:.2f}', xy=(.1, .9), xycoords=ax.transAxes)

np.random.seed(12)

test_df = pd.DataFrame({
    "x": np.arange(5),
    "y": np.array([0,2,np.nan, 5,8]),
    "z": np.random.randint(1,4,5)
})

g = sns.pairplot(test_df, corner=True)
g.map_lower(corrfunc)

image

Obviously, this is not what we wanted. What is strange about this is, that PairGrid won't work and in this sense behaves much nicer:

g = sns.PairGrid(test_df, palette=["red"])
g.map_lower(plt.scatter, s=10)
g.map_diag(sns.histplot, kde=False)
g.map_lower(corrfunc)

returns

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-62-6e1a203f6853> in <module>
      2 g.map_lower(plt.scatter, s=10)
      3 g.map_diag(sns.histplot, kde=False)
----> 4 g.map_lower(corrfunc)

~/anaconda3/lib/python3.8/site-packages/seaborn/axisgrid.py in map_lower(self, func, **kwargs)
   1264         """
   1265         indices = zip(*np.tril_indices_from(self.axes, -1))
-> 1266         self._map_bivariate(func, indices, **kwargs)
   1267         return self
   1268 

~/anaconda3/lib/python3.8/site-packages/seaborn/axisgrid.py in _map_bivariate(self, func, indices, **kwargs)
   1432             y_var = self.y_vars[i]
   1433             ax = self.axes[i, j]
-> 1434             self._plot_bivariate(x_var, y_var, ax, func, **kws)
   1435         self._add_axis_labels()
   1436 

~/anaconda3/lib/python3.8/site-packages/seaborn/axisgrid.py in _plot_bivariate(self, x_var, y_var, ax, func, **kwargs)
   1441         """Draw a bivariate plot on the specified axes."""
   1442         if "hue" not in signature(func).parameters:
-> 1443             self._plot_bivariate_iter_hue(x_var, y_var, ax, func, **kwargs)
   1444             return
   1445 

~/anaconda3/lib/python3.8/site-packages/seaborn/axisgrid.py in _plot_bivariate_iter_hue(self, x_var, y_var, ax, func, **kwargs)
   1509                 func(x=x, y=y, **kws)
   1510             else:
-> 1511                 func(x, y, **kws)
   1512 
   1513         self._update_legend_data(ax)

<ipython-input-61-4c476815e91a> in corrfunc(x, y, ax, **kws)
      6 def corrfunc(x, y, ax=None, **kws):
      7     """Plot the correlation coefficient in the top left hand corner of a plot."""
----> 8     r, _ = stats.pearsonr(x, y)
      9     ax = ax or plt.gca()
     10     ax.annotate(f'ρ = {r:.2f}', xy=(.1, .9), xycoords=ax.transAxes)

~/anaconda3/lib/python3.8/site-packages/scipy/stats/stats.py in pearsonr(x, y)
   3866     # [-5e210, 5e210, 3e200, -3e200]
   3867     normxm = linalg.norm(xm)
-> 3868     normym = linalg.norm(ym)
   3869 
   3870     threshold = 1e-13

~/anaconda3/lib/python3.8/site-packages/scipy/linalg/misc.py in norm(a, ord, axis, keepdims, check_finite)
    138     # Differs from numpy only in non-finite handling and the use of blas.
    139     if check_finite:
--> 140         a = np.asarray_chkfinite(a)
    141     else:
    142         a = np.asarray(a)

~/anaconda3/lib/python3.8/site-packages/numpy/lib/function_base.py in asarray_chkfinite(a, dtype, order)
    483     a = asarray(a, dtype=dtype, order=order)
    484     if a.dtype.char in typecodes['AllFloat'] and not np.isfinite(a).all():
--> 485         raise ValueError(
    486             "array must not contain infs or NaNs")
    487     return a

ValueError: array must not contain infs or NaNs

I am not sure what would be the best but definitely not let run pairplot silently (it took me quite some time to figure this out).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.