@@ -5,11 +5,6 @@ v0.12.0 (July 24, 2013)
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.11.0 and includes several new features and
15
10
enhancements along with a large number of bug fixes.
@@ -52,7 +47,7 @@ API changes
52
47
53
48
.. ipython :: python
54
49
55
- p = DataFrame({ ' first' : [4 ,5 , 8 ], ' second' : [0 ,0 , 3 ] })
50
+ p = pd. DataFrame({' first' : [4 , 5 , 8 ], ' second' : [0 , 0 , 3 ] })
56
51
p % 0
57
52
p % p
58
53
p / p
@@ -66,10 +61,13 @@ API changes
66
61
67
62
.. ipython :: python
68
63
69
- df2 = DataFrame([{" val1" : 1 , " val2" : 20 }, {" val1" :1 , " val2" : 19 },
70
- {" val1" :1 , " val2" : 27 }, {" val1" :1 , " val2" : 12 }])
64
+ df2 = pd.DataFrame([{" val1" : 1 , " val2" : 20 },
65
+ {" val1" : 1 , " val2" : 19 },
66
+ {" val1" : 1 , " val2" : 27 },
67
+ {" val1" : 1 , " val2" : 12 }])
68
+
71
69
def func (dataf ):
72
- return dataf[" val2" ] - dataf[" val2" ].mean()
70
+ return dataf[" val2" ] - dataf[" val2" ].mean()
73
71
74
72
# squeezing the result frame to a series (because we have unique groups)
75
73
df2.groupby(" val1" , squeeze = True ).apply(func)
@@ -91,8 +89,8 @@ API changes
91
89
92
90
.. ipython :: python
93
91
94
- df = DataFrame(lrange(5 ), list (' ABCDE' ), columns = [' a' ])
95
- mask = (df.a% 2 == 0 )
92
+ df = pd. DataFrame(lrange(5 ), list (' ABCDE' ), columns = [' a' ])
93
+ mask = (df.a % 2 == 0 )
96
94
mask
97
95
98
96
# this is what you should use
@@ -152,7 +150,7 @@ API changes
152
150
.. code-block :: python
153
151
154
152
from pandas.io.sql import read_frame
155
- read_frame(... . )
153
+ read_frame(... )
156
154
157
155
- ``DataFrame.to_html `` and ``DataFrame.to_latex `` now accept a path for
158
156
their first argument (:issue: `3702 `)
@@ -196,7 +194,7 @@ I/O Enhancements
196
194
.. ipython :: python
197
195
:okwarning:
198
196
199
- df = DataFrame({'a': range(3), 'b': list('abc')})
197
+ df = pd. DataFrame({'a': range(3), 'b': list('abc')})
200
198
print(df)
201
199
html = df.to_html()
202
200
alist = pd.read_html(html, index_col=0)
@@ -247,7 +245,7 @@ I/O Enhancements
247
245
df = mkdf(5 , 3 , r_idx_nlevels = 2 , c_idx_nlevels = 4 )
248
246
df.to_csv(' mi.csv' )
249
247
print (open (' mi.csv' ).read())
250
- pd.read_csv(' mi.csv' , header = [0 ,1 , 2 , 3 ], index_col = [0 ,1 ])
248
+ pd.read_csv(' mi.csv' , header = [0 , 1 , 2 , 3 ], index_col = [0 , 1 ])
251
249
252
250
.. ipython :: python
253
251
:suppress:
@@ -264,10 +262,10 @@ I/O Enhancements
264
262
265
263
In [25]: path = 'store_iterator.h5'
266
264
267
- In [26]: DataFrame(randn(10,2)).to_hdf(path,'df',table=True)
265
+ In [26]: pd. DataFrame(np.random. randn(10, 2)).to_hdf(path, 'df', table=True)
268
266
269
- In [27]: for df in read_hdf(path,'df', chunksize=3):
270
- ....: print df
267
+ In [27]: for df in pd. read_hdf(path, 'df', chunksize=3):
268
+ ....: print(df)
271
269
....:
272
270
0 1
273
271
0 0.713216 -0.778461
@@ -300,7 +298,7 @@ Other Enhancements
300
298
301
299
.. ipython :: python
302
300
303
- df = DataFrame({'a': list('ab..'), 'b': [1, 2, 3, 4]})
301
+ df = pd. DataFrame({'a': list('ab..'), 'b': [1, 2, 3, 4]})
304
302
df.replace(regex=r'\s*\.\s*', value=np.nan)
305
303
306
304
to replace all occurrences of the string ``'.' `` with zero or more
@@ -342,7 +340,7 @@ Other Enhancements
342
340
343
341
.. ipython :: python
344
342
345
- sf = Series([1 , 1 , 2 , 3 , 3 , 3 ])
343
+ sf = pd. Series([1 , 1 , 2 , 3 , 3 , 3 ])
346
344
sf.groupby(sf).filter(lambda x : x.sum() > 2 )
347
345
348
346
The argument of ``filter `` must a function that, applied to the group as a
@@ -353,7 +351,7 @@ Other Enhancements
353
351
354
352
.. ipython :: python
355
353
356
- dff = DataFrame({' A' : np.arange(8 ), ' B' : list (' aabbbbcc' )})
354
+ dff = pd. DataFrame({' A' : np.arange(8 ), ' B' : list (' aabbbbcc' )})
357
355
dff.groupby(' B' ).filter(lambda x : len (x) > 2 )
358
356
359
357
Alternatively, instead of dropping the offending groups, we can return a
@@ -400,8 +398,8 @@ Experimental Features
400
398
bday_egypt = CustomBusinessDay(holidays = holidays, weekmask = weekmask_egypt)
401
399
dt = datetime(2013 , 4 , 30 )
402
400
print (dt + 2 * bday_egypt)
403
- dts = date_range(dt, periods = 5 , freq = bday_egypt)
404
- print (Series(dts.weekday, dts).map(Series(' Mon Tue Wed Thu Fri Sat Sun' .split())))
401
+ dts = pd. date_range(dt, periods = 5 , freq = bday_egypt)
402
+ print (pd. Series(dts.weekday, dts).map(pd. Series(' Mon Tue Wed Thu Fri Sat Sun' .split())))
405
403
406
404
Bug Fixes
407
405
~~~~~~~~~
@@ -424,7 +422,7 @@ Bug Fixes
424
422
.. ipython :: python
425
423
426
424
strs = ' go' , ' bow' , ' joe' , ' slow'
427
- ds = Series(strs)
425
+ ds = pd. Series(strs)
428
426
429
427
for s in ds.str:
430
428
print (s)
0 commit comments