Error while loading csv file

urlpath = ‘

URLError: <urlopen error [Errno 11004] getaddrinfo failed>

I tried different solutions which I got through stack overflow but didn’t succeed.
import pandas as pd
import requests
I get connection error here.

Can someone help?

The error indicates that the IP address for the site is not being found. So something is going wrong with a DNS lookup where you are running the code. Without any further information on the environment where you are running the code, I can’t really help any further.


I have changed your code to:

import requests
import pandas as pd
import io

url = ""
urlData = requests.get(url).content
rawData = pd.read_csv(io.StringIO(urlData.decode('utf-8')))


That is the result I get:

Country Name Country Code  Year         Value
0       Arab World          ARB  1968  2.576068e+10
1       Arab World          ARB  1969  2.843420e+10
2       Arab World          ARB  1970  3.138550e+10
3       Arab World          ARB  1971  3.642691e+10
4       Arab World          ARB  1972  4.331606e+10
...            ...          ...   ...           ...
11502     Zimbabwe          ZWE  2012  1.424249e+10
11503     Zimbabwe          ZWE  2013  1.545177e+10
11504     Zimbabwe          ZWE  2014  1.589105e+10
11505     Zimbabwe          ZWE  2015  1.630467e+10
11506     Zimbabwe          ZWE  2016  1.661996e+10

[11507 rows x 4 columns]

I hope it helps!

Hi, unfortunately this didn’t work as well, I tried to mention this code in my question also but I am not allowed to post more than 2 links. The error here is same ConnectionError: HTTPSConnectionPool(host=‘’, port=443): Max retries exceeded with url: /datasets/gdp/master/data/gdp.csv (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x0000020CF5764088>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed’))

Is there some other way ?

The issue isn’t your code, it is that there is something wrong with the network on the machine that is running the code. That machine is not getting an IP address for the URL to establish the connection. I need details of that machine in order to possibly help you further.

I too think the same but I am unable to fix it, What details do you need ?

Is it local or is it a cloud service like If it is local, what is the Operating System (Windows, Linux, or macOS)? From there I can then figure out how to troubleshoot the network.

Sorry for late reply.
Its local, OS- Windows 10

In a command window, does the command nslookup return with something like this?


Non-authoritative answer:


If it doesn’t then it means your DNS server is not returning an answer. If that is the case, try changing your DNS server in network settings to Google’s public DNS server which is and see if that works.

If it does return with a list of addresses, and Python is still not working, then something is blocking the python program from connecting and my recommendation then would be to use your browser to download the CSV file from the link, place it in the same place as the Python program and then just use pd.read_csv('gdp.csv')

checked for the command and it returned the below:
Server: UnKnown
Address: my local ip Name: raw.githubusercontent Addresses: ::

I have removed .com from the name since I am not allowed to post link here.
I will try changing the DNS server to Google’s public DNS server and try again.
Thanks a lot :grinning: