pandas datareader returns remote data error from eurostat but also returns large amount of response text

53 views Asked by At

I have looked up several articles on reading data from eurostat but I get RemoteDataError returned when I try each suggestion.

Are the documwents that I have read out of date?

Do I need to pass some kind of token?

What is happening here?

for example (running in spyder):

import pandas as pds

import pandas_datareader.data as web

from pandas_datareader._utils import RemoteDataError

try:
    eurostat_df = web.DataReader('tps00001', 'eurostat', '2021-12-31', '2022-12-31')
except RemoteDataError:
    print(" Could not access data from Eurostat")
    exit()
    

eurostat_df = eurostat_df.T.reset_index()

print(eurostat_df.info())

This returns:

runfile('/home/jacslim/Documents/DataChen/src/date_subset.py', wdir='/home/jacslim/Documents/DataChen/src')
 Could not access data from Eurostat
Traceback (most recent call last):

  File ~/Documents/DataChen/src/date_subset.py:16
    eurostat_df = web.DataReader('tps00001', 'eurostat', '2021-12-31', '2022-12-31')

  File /opt/anaconda3/lib/python3.9/site-packages/pandas/util/_decorators.py:207 in wrapper
    return func(*args, **kwargs)

  File /opt/anaconda3/lib/python3.9/site-packages/pandas_datareader/data.py:478 in DataReader
    return EurostatReader(

  File /opt/anaconda3/lib/python3.9/site-packages/pandas_datareader/base.py:101 in read
    return self._read_one_data(self.url, self.params)

  File /opt/anaconda3/lib/python3.9/site-packages/pandas_datareader/eurostat.py:33 in _read_one_data
    resp_dsd = self._get_response(self.dsd_url)

  File /opt/anaconda3/lib/python3.9/site-packages/pandas_datareader/base.py:181 in _get_response
    raise RemoteDataError(msg)

RemoteDataError: Unable to read URL: http://ec.europa.eu/eurostat/SDMX/diss-web/rest/datastructure/ESTAT/DSD_tps00001
Response Text:
b'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\t\n\t\t\t<!DOCTYPE html>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<html dir="ltr" lang="en-GB">\n\n<head>\n    <title>Status 404 - Eurostat</title>\n    <meta content="initial-scale=1.0, width=device-width" name="viewport" />\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<meta content="text/html; charset=UTF-8" http-equiv="content-type" />\n\n\n\n\n\n\n\n\n\n\n\n<meta name="google-site-verification" content="6XK2M_NqFEhF79UhdF43-Zv2t58zbBUp_CYAAKDHjgo" />\n<meta name="google-site-verification" content="in2pBF1QfAtURduPbpP5i-jI0MycWywIlnAImhgFALc" />\n<script type="text/javascript" src="/eurostat/ruxitagentjs_ICA2NVfgjqrux_10259230221142207.js" data-dtconfig="app=e63eebabdf39f376|agentId=8ccff3c874af1498|featureHash=ICA2NVfgjqrux|vcv=2|rdnt=1|uxrgce=1|bp=3|cuc=m097nmfl|mel=100000|dpvc=1|ssv=4|lastModification=1696615512013|tp=500,50,0,1|agentUri=/eurostat/ruxitagentjs_ICA2NVfgjqrux_10259230221142207.js|reportUrl=/eurostat/rb_39a3e95b-5423-482c-879b-99ef235dffeb|rid=RID_1094167413|rpid=-591744139|domain=europa.eu/eurostat"></script><script type="app

... and so on for a large amount of data which seems to me like the datareader did not process the response into a dataframe.

0

There are 0 answers