3
df = sns.load_dataset("tips") 

I am trying to load dataset using seaborn, which results in the follow URLError:

TimeoutError                              Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python311\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 ~\AppData\Local\Programs\Python\Python311\Lib\http\client.py:1282, in HTTPConnection.request(self, method, url, body, headers, encode_chunked)
   1281 """Send a complete request to the server."""
-> 1282 self._send_request(method, url, body, headers, encode_chunked)



File ~\AppData\Local\Programs\Python\Python311\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.



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>

I tried changing the internet connection and also tried unchecking the proxy server in LAN settings

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

1 Answers1

1
  • The error 10060 means you cannot connect to the remote place. There might be several reasons for such an error:
    • Problems with certificates. Please, see this post on Stackoverflow to get more details.
    • It might be because of the network's problems or your setting issues, such as proxy setting. To solve the issue, check this post as well.
    • Some non-standard OSs, like ChromeOS Flex, may not work, as indicated here.
    • Make sure you're not behind a VPN.
  • Try downloading the data with an alternate method
    • directly with pandas
    • with requests and then load into pandas
import pandas as pd

df = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv')
import requests
import io

t = requests.get('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv').text

df = pd.read_csv(io.StringIO(t))
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
dzhu_man_dzhi
  • 82
  • 1
  • 1
  • 6