6
6
import pandas .util .testing as tm
7
7
import pandas_datareader .data as web
8
8
9
+ from pandas_datareader ._utils import PANDAS_0170
10
+
9
11
10
12
class TestEurostat (tm .TestCase ):
11
13
@@ -40,33 +42,29 @@ def test_get_cdh_e_fos(self):
40
42
tm .assert_frame_equal (df , expected )
41
43
42
44
def test_get_sts_cobp_a (self ):
43
-
44
- raise nose .SkipTest ("This raises error because of data amount, "
45
- "should be fixed in #149" )
46
-
47
45
# Building permits - annual data (2010 = 100)
48
46
df = web .DataReader ('sts_cobp_a' , 'eurostat' ,
49
- start = pd .Timestamp ('1992 -01-01' ),
47
+ start = pd .Timestamp ('2000 -01-01' ),
50
48
end = pd .Timestamp ('2013-01-01' ))
51
49
52
- idx = pd .date_range ('1992 -01-01' , '2013-01-01' , freq = 'AS' ,
50
+ idx = pd .date_range ('2000 -01-01' , '2013-01-01' , freq = 'AS' ,
53
51
name = 'TIME_PERIOD' )
54
- ne_name = ('Building permits - m2 of useful floor area' ,
52
+ ne_name = ('Index, 2010=100' ,
53
+ 'Building permits - m2 of useful floor area' ,
55
54
'Unadjusted data (i.e. neither seasonally adjusted nor calendar adjusted data)' ,
56
55
'Non-residential buildings, except office buildings' ,
57
56
'Netherlands' , 'Annual' )
58
- ne_values = [np .nan , np .nan , np .nan , 144.53 , 136.97 , 180.02 , 198.36 ,
59
- 215.12 , 200.05 , 186.46 , 127.33 , 130.67 , 143.26 , 147.83 ,
57
+ ne_values = [200.05 , 186.46 , 127.33 , 130.67 , 143.26 , 147.83 ,
60
58
176.69 , 227.36 , 199.45 , 128.49 , 100.0 , 113.83 , 89.33 ,
61
59
77.57 ]
62
60
ne = pd .Series (ne_values , name = ne_name , index = idx )
63
61
64
- uk_name = ('Building permits - m2 of useful floor area' ,
62
+ uk_name = ('Index, 2010=100' ,
63
+ 'Building permits - m2 of useful floor area' ,
65
64
'Unadjusted data (i.e. neither seasonally adjusted nor calendar adjusted data)' ,
66
65
'Non-residential buildings, except office buildings' ,
67
66
'United Kingdom' , 'Annual' )
68
- uk_values = [np .nan , np .nan , np .nan , np .nan , np .nan , np .nan , 120.37 ,
69
- 115.93 , 112.53 , 113.32 , 110.18 , 112.14 , 119.06 , 112.66 ,
67
+ uk_values = [112.53 , 113.32 , 110.18 , 112.14 , 119.06 , 112.66 ,
70
68
113.05 , 121.8 , 113.97 , 105.88 , 100.0 , 98.56 , 103.69 ,
71
69
81.32 ]
72
70
uk = pd .Series (uk_values , name = uk_name , index = idx )
@@ -75,6 +73,39 @@ def test_get_sts_cobp_a(self):
75
73
result = df [expected .name ]
76
74
tm .assert_series_equal (result , expected )
77
75
76
+ def test_get_nrg_pc_202 (self ):
77
+ # GH 149
78
+
79
+ if not PANDAS_0170 :
80
+ raise nose .SkipTest ("skip because of comparison failure" )
81
+
82
+ df = web .DataReader ('nrg_pc_202' , 'eurostat' ,
83
+ start = pd .Timestamp ('2010-01-01' ),
84
+ end = pd .Timestamp ('2013-01-01' ))
85
+
86
+ name = ('All taxes and levies included' ,
87
+ 'Gigajoules (Gross calorific value = GCV)' ,
88
+ 'Euro' ,
89
+ 'Band D1 : Consumption < 20 GJ' ,
90
+ 'Natural gas' , 'Denmark' , 'Semi-annual' )
91
+
92
+ exp_index = pd .Index (['2013-B2' , '2013-B1' , '2012-B2' , '2012-B1' ,
93
+ '2011-B2' , '2011-B1' , '2010-B2' , '2010-B1' ],
94
+ name = 'TIME_PERIOD' )
95
+ exp = pd .Series ([27.1403 , 27.5854 , 26.5285 , 27.2187 ,
96
+ 28.5862 , 28.6448 , 26.8147 , 26.4979 ],
97
+ index = exp_index , name = name )
98
+ tm .assert_series_equal (df [name ], exp )
99
+
100
+ def test_get_prc_hicp_manr_exceeds_limit (self ):
101
+ # GH 149
102
+ msg = 'Query size exceeds maximum limit'
103
+ with tm .assertRaisesRegexp (ValueError , msg ):
104
+ web .DataReader ('prc_hicp_manr' , 'eurostat' ,
105
+ start = pd .Timestamp ('2000-01-01' ),
106
+ end = pd .Timestamp ('2013-01-01' ))
107
+
108
+
78
109
if __name__ == '__main__' :
79
110
nose .runmodule (argv = [__file__ , '-vvs' , '-x' , '--pdb' , '--pdb-failure' ],
80
111
exit = False )
0 commit comments