@@ -5,11 +5,6 @@ v0.18.0 (March 13, 2016)
5
5
6
6
{{ header }}
7
7
8
- .. ipython :: python
9
- :suppress:
10
-
11
- from pandas import * # noqa F401, F403
12
-
13
8
14
9
This is a major release from 0.17.1 and includes a small number of API changes, several new features,
15
10
enhancements, and performance improvements along with a large number of bug fixes. We recommend that all
@@ -64,14 +59,14 @@ Window functions have been refactored to be methods on ``Series/DataFrame`` obje
64
59
.. ipython :: python
65
60
66
61
np.random.seed(1234 )
67
- df = pd.DataFrame({' A' : range (10 ), ' B' : np.random.randn(10 )})
62
+ df = pd.DataFrame({' A' : range (10 ), ' B' : np.random.randn(10 )})
68
63
df
69
64
70
65
Previous Behavior:
71
66
72
67
.. code-block :: ipython
73
68
74
- In [8]: pd.rolling_mean(df,window=3)
69
+ In [8]: pd.rolling_mean(df, window=3)
75
70
FutureWarning: pd.rolling_mean is deprecated for DataFrame and will be removed in a future version, replace with
76
71
DataFrame.rolling(window=3,center=False).mean()
77
72
Out[8]:
@@ -102,7 +97,7 @@ with tab-completion of available methods and properties.
102
97
103
98
.. code-block :: ipython
104
99
105
- In [9]: r.
100
+ In [9]: r.<TAB> # noqa E225, E999
106
101
r.A r.agg r.apply r.count r.exclusions r.max r.median r.name r.skew r.sum
107
102
r.B r.aggregate r.corr r.cov r.kurt r.mean r.min r.quantile r.std r.var
108
103
@@ -122,8 +117,8 @@ And multiple aggregations
122
117
123
118
.. ipython :: python
124
119
125
- r.agg({' A' : [' mean' ,' std' ],
126
- ' B' : [' mean' ,' std' ]})
120
+ r.agg({' A' : [' mean' , ' std' ],
121
+ ' B' : [' mean' , ' std' ]})
127
122
128
123
.. _whatsnew_0180.enhancements.rename :
129
124
@@ -201,7 +196,7 @@ Currently the default is ``expand=None`` which gives a ``FutureWarning`` and use
201
196
202
197
.. code-block :: ipython
203
198
204
- In [1]: pd.Series(['a1', 'b2', 'c3']).str.extract('[ab](\d)', expand=None)
199
+ In [1]: pd.Series(['a1', 'b2', 'c3']).str.extract(r '[ab](\d)', expand=None)
205
200
FutureWarning: currently extract(expand=None) means expand=False (return Index/Series/DataFrame)
206
201
but in a future version of pandas this will be changed to expand=True (return DataFrame)
207
202
@@ -216,13 +211,13 @@ Extracting a regular expression with one group returns a Series if
216
211
217
212
.. ipython :: python
218
213
219
- pd.Series([' a1' , ' b2' , ' c3' ]).str.extract(' [ab](\d)' , expand = False )
214
+ pd.Series([' a1' , ' b2' , ' c3' ]).str.extract(r ' [ab ]( \d ) ' , expand = False )
220
215
221
216
It returns a ``DataFrame `` with one column if ``expand=True ``.
222
217
223
218
.. ipython :: python
224
219
225
- pd.Series([' a1' , ' b2' , ' c3' ]).str.extract(' [ab](\d)' , expand = True )
220
+ pd.Series([' a1' , ' b2' , ' c3' ]).str.extract(r ' [ab ]( \d ) ' , expand = True )
226
221
227
222
Calling on an ``Index `` with a regex with exactly one capture group
228
223
returns an ``Index `` if ``expand=False ``.
@@ -270,13 +265,13 @@ match.
270
265
271
266
s = pd.Series([" a1a2" , " b1" , " c1" ], [" A" , " B" , " C" ])
272
267
s
273
- s.str.extract(" (?P<letter>[ab])(?P<digit>\d)" , expand = False )
268
+ s.str.extract(r " ( ?P<letter> [ab ]) ( ?P<digit> \d ) " , expand = False )
274
269
275
270
The ``extractall `` method returns all matches.
276
271
277
272
.. ipython :: python
278
273
279
- s.str.extractall(" (?P<letter>[ab])(?P<digit>\d)" )
274
+ s.str.extractall(r " ( ?P<letter> [ab ]) ( ?P<digit> \d ) " )
280
275
281
276
.. _whatsnew_0180.enhancements.strcat :
282
277
@@ -289,12 +284,12 @@ A new, friendlier ``ValueError`` is added to protect against the mistake of supp
289
284
290
285
.. ipython :: python
291
286
292
- pd.Series([' a' ,' b' ,np.nan,' c' ]).str.cat(sep = ' ' )
293
- pd.Series([' a' ,' b' ,np.nan,' c' ]).str.cat(sep = ' ' , na_rep = ' ?' )
287
+ pd.Series([' a' , ' b' , np.nan, ' c' ]).str.cat(sep = ' ' )
288
+ pd.Series([' a' , ' b' , np.nan, ' c' ]).str.cat(sep = ' ' , na_rep = ' ?' )
294
289
295
290
.. code-block :: ipython
296
291
297
- In [2]: pd.Series(['a','b',np.nan,'c']).str.cat(' ')
292
+ In [2]: pd.Series(['a', 'b', np.nan, 'c']).str.cat(' ')
298
293
ValueError: Did you mean to supply a `sep` keyword?
299
294
300
295
@@ -329,7 +324,7 @@ Timedeltas
329
324
330
325
.. ipython :: python
331
326
332
- t = timedelta_range(' 1 days 2 hr 13 min 45 us' ,periods = 3 ,freq = ' d' )
327
+ t = timedelta_range(' 1 days 2 hr 13 min 45 us' , periods = 3 , freq = ' d' )
333
328
t
334
329
t.round(' 10min' )
335
330
@@ -356,7 +351,7 @@ Previous Behavior:
356
351
357
352
.. code-block :: ipython
358
353
359
- In [2]: s = pd.Series([1,2, 3], index=np.arange(3.))
354
+ In [2]: s = pd.Series([1, 2, 3], index=np.arange(3.))
360
355
361
356
In [3]: s
362
357
Out[3]:
@@ -378,7 +373,7 @@ New Behavior:
378
373
379
374
.. ipython :: python
380
375
381
- s = pd.Series([1 ,2 , 3 ], index = np.arange(3 .))
376
+ s = pd.Series([1 , 2 , 3 ], index = np.arange(3 .))
382
377
s
383
378
s.index
384
379
print (s.to_csv(path_or_buf = None , header = False ))
@@ -727,7 +722,8 @@ Like the change in the window functions API :ref:`above <whatsnew_0180.enhanceme
727
722
np.random.seed(1234 )
728
723
df = pd.DataFrame(np.random.rand(10 ,4 ),
729
724
columns = list (' ABCD' ),
730
- index = pd.date_range(' 2010-01-01 09:00:00' , periods = 10 , freq = ' s' ))
725
+ index = pd.date_range(' 2010-01-01 09:00:00' ,
726
+ periods = 10 , freq = ' s' ))
731
727
df
732
728
733
729
@@ -1137,7 +1133,7 @@ and setting
1137
1133
1138
1134
Positional setting with ``.ix `` and a float indexer will ADD this value to the index, rather than previously setting the value by position.
1139
1135
1140
- .. code-block :: python
1136
+ .. code-block :: ipython
1141
1137
1142
1138
In [3]: s2.ix[1.0] = 10
1143
1139
In [4]: s2
0 commit comments