@@ -107,7 +107,7 @@ by using the ``wb`` I/O functions.
107
107
For example, if you wanted to compare the Gross Domestic Products per capita in
108
108
constant dollars in North America, you would use the ``search `` function:
109
109
110
- .. code :: python
110
+ .. code-block :: python
111
111
112
112
In [1 ]: from pandas.io import wb
113
113
@@ -122,7 +122,7 @@ constant dollars in North America, you would use the ``search`` function:
122
122
Then you would use the `` download`` function to acquire the data from the World
123
123
Bank' s servers:
124
124
125
- .. code:: python
125
+ .. code- block :: python
126
126
127
127
In [3 ]: dat = wb.download(indicator = ' NY.GDP.PCAP.KD' , country = [' US' , ' CA' , ' MX' ], start = 2005 , end = 2008 )
128
128
@@ -145,7 +145,7 @@ Bank's servers:
145
145
The resulting dataset is a properly formatted `` DataFrame`` with a hierarchical
146
146
index, so it is easy to apply `` .groupby`` transformations to it:
147
147
148
- .. code:: python
148
+ .. code- block :: python
149
149
150
150
In [6 ]: dat[' NY.GDP.PCAP.KD' ].groupby(level = 0 ).mean()
151
151
Out[6 ]:
@@ -158,7 +158,7 @@ index, so it is easy to apply ``.groupby`` transformations to it:
158
158
Now imagine you want to compare GDP to the share of people with cellphone
159
159
contracts around the world.
160
160
161
- .. code:: python
161
+ .. code- block :: python
162
162
163
163
In [7 ]: wb.search(' cell.*%' ).iloc[:,:2 ]
164
164
Out[7 ]:
@@ -170,7 +170,7 @@ contracts around the world.
170
170
Notice that this second search was much faster than the first one because
171
171
`` Pandas`` now has a cached list of available data series.
172
172
173
- .. code:: python
173
+ .. code- block :: python
174
174
175
175
In [13 ]: ind = [' NY.GDP.PCAP.KD' , ' IT.MOB.COV.ZS' ]
176
176
In [14 ]: dat = wb.download(indicator = ind, country = ' all' , start = 2011 , end = 2011 ).dropna()
@@ -188,7 +188,7 @@ Finally, we use the ``statsmodels`` package to assess the relationship between
188
188
our two variables using ordinary least squares regression. Unsurprisingly,
189
189
populations in rich countries tend to use cellphones at a higher rate:
190
190
191
- .. code:: python
191
+ .. code- block :: python
192
192
193
193
In [17 ]: import numpy as np
194
194
In [18 ]: import statsmodels.formula.api as smf
0 commit comments