Aug-20-2020, 11:24 AM
Hello everyone,
I'm beginner in Python, i'd like to use titanic dataset from Seaborn.
The code
I'm beginner in Python, i'd like to use titanic dataset from Seaborn.
The code
import seaborn as sns titanic = sns.load_dataset('titanic')I have this error
Error:---------------------------------------------------------------------------
gaierror Traceback (most recent call last)
~\Anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1349 try:
-> 1350 h.request(req.get_method(), req.selector, req.data, headers,
1351 encode_chunked=req.has_header('Transfer-encoding'))
~\Anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1239 """Send a complete request to the server."""
-> 1240 self._send_request(method, url, body, headers, encode_chunked)
1241
~\Anaconda3\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1285 body = _encode(body, 'body')
-> 1286 self.endheaders(body, encode_chunked=encode_chunked)
1287
~\Anaconda3\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1234 raise CannotSendHeader()
-> 1235 self._send_output(message_body, encode_chunked=encode_chunked)
1236
~\Anaconda3\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1005 del self._buffer[:]
-> 1006 self.send(msg)
1007
~\Anaconda3\lib\http\client.py in send(self, data)
945 if self.auto_open:
--> 946 self.connect()
947 else:
~\Anaconda3\lib\http\client.py in connect(self)
1401
-> 1402 super().connect()
1403
~\Anaconda3\lib\http\client.py in connect(self)
916 """Connect to the host and port specified in __init__."""
--> 917 self.sock = self._create_connection(
918 (self.host,self.port), self.timeout, self.source_address)
~\Anaconda3\lib\socket.py in create_connection(address, timeout, source_address)
786 err = None
--> 787 for res in getaddrinfo(host, port, 0, SOCK_STREAM):
788 af, socktype, proto, canonname, sa = res
~\Anaconda3\lib\socket.py in getaddrinfo(host, port, family, type, proto, flags)
917 addrlist = []
--> 918 for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
919 af, socktype, proto, canonname, sa = res
gaierror: [Errno 11004] getaddrinfo failed
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
<ipython-input-3-e3b2d17e7451> in <module>
1 import seaborn as sns
----> 2 titanic = sns.load_dataset('titanic')
~\Anaconda3\lib\site-packages\seaborn\utils.py in load_dataset(name, cache, data_home, **kws)
447 os.path.basename(full_path))
448 if not os.path.exists(cache_path):
--> 449 urlretrieve(full_path, cache_path)
450 full_path = cache_path
451
~\Anaconda3\lib\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\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\urllib\request.py in open(self, fullurl, data, timeout)
523
524 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 525 response = self._open(req, data)
526
527 # post-process response
~\Anaconda3\lib\urllib\request.py in _open(self, req, data)
540
541 protocol = req.type
--> 542 result = self._call_chain(self.handle_open, protocol, protocol +
543 '_open', req)
544 if result:
~\Anaconda3\lib\urllib\request.py in _call_chain(self, chain, kind, meth_name, *args)
500 for handler in handlers:
501 func = getattr(handler, meth_name)
--> 502 result = func(*args)
503 if result is not None:
504 return result
~\Anaconda3\lib\urllib\request.py in https_open(self, req)
1391
1392 def https_open(self, req):
-> 1393 return self.do_open(http.client.HTTPSConnection, req,
1394 context=self._context, check_hostname=self._check_hostname)
1395
~\Anaconda3\lib\urllib\request.py in do_open(self, http_class, req, **http_conn_args)
1351 encode_chunked=req.has_header('Transfer-encoding'))
1352 except OSError as err: # timeout error
-> 1353 raise URLError(err)
1354 r = h.getresponse()
1355 except:
URLError: <urlopen error [Errno 11004] getaddrinfo failed>
Can you help me please?