@@ -8,7 +8,6 @@ v0.17.0 (October 9, 2015)
8
8
.. ipython :: python
9
9
:suppress:
10
10
11
- from pandas import * # noqa F401, F403
12
11
13
12
14
13
This is a major release from 0.16.2 and includes a small number of API changes, several new features,
@@ -85,9 +84,9 @@ The new implementation allows for having a single-timezone across all rows, with
85
84
86
85
.. ipython :: python
87
86
88
- df = DataFrame({' A' : date_range(' 20130101' ,periods = 3 ),
89
- ' B' : date_range(' 20130101' ,periods = 3 ,tz = ' US/Eastern' ),
90
- ' C' : date_range(' 20130101' ,periods = 3 ,tz = ' CET' )})
87
+ df = DataFrame({' A' : date_range(' 20130101' , periods = 3 ),
88
+ ' B' : date_range(' 20130101' , periods = 3 , tz = ' US/Eastern' ),
89
+ ' C' : date_range(' 20130101' , periods = 3 , tz = ' CET' )})
91
90
df
92
91
df.dtypes
93
92
@@ -112,20 +111,20 @@ This uses a new-dtype representation as well, that is very similar in look-and-f
112
111
113
112
.. code-block :: ipython
114
113
115
- In [1]: pd.date_range('20130101',periods=3,tz='US/Eastern')
114
+ In [1]: pd.date_range('20130101', periods=3, tz='US/Eastern')
116
115
Out[1]: DatetimeIndex(['2013-01-01 00:00:00-05:00', '2013-01-02 00:00:00-05:00',
117
116
'2013-01-03 00:00:00-05:00'],
118
117
dtype='datetime64[ns]', freq='D', tz='US/Eastern')
119
118
120
- In [2]: pd.date_range('20130101',periods=3,tz='US/Eastern').dtype
119
+ In [2]: pd.date_range('20130101', periods=3, tz='US/Eastern').dtype
121
120
Out[2]: dtype('<M8[ns]')
122
121
123
122
New Behavior:
124
123
125
124
.. ipython :: python
126
125
127
- pd.date_range(' 20130101' ,periods = 3 ,tz = ' US/Eastern' )
128
- pd.date_range(' 20130101' ,periods = 3 ,tz = ' US/Eastern' ).dtype
126
+ pd.date_range(' 20130101' , periods = 3 , tz = ' US/Eastern' )
127
+ pd.date_range(' 20130101' , periods = 3 , tz = ' US/Eastern' ).dtype
129
128
130
129
.. _whatsnew_0170.gil :
131
130
@@ -143,8 +142,8 @@ as well as the ``.sum()`` operation.
143
142
144
143
N = 1000000
145
144
ngroups = 10
146
- df = DataFrame({' key' : np.random.randint(0 ,ngroups,size = N),
147
- ' data' : np.random.randn(N) })
145
+ df = DataFrame({' key' : np.random.randint(0 , ngroups, size = N),
146
+ ' data' : np.random.randn(N)})
148
147
df.groupby(' key' )[' data' ].sum()
149
148
150
149
Releasing of the GIL could benefit an application that uses threads for user interactions (e.g. QT _), or performing multi-threaded computations. A nice example of a library that can handle these types of computation-in-parallel is the dask _ library.
@@ -175,7 +174,7 @@ As a result of this change, these methods are now all discoverable via tab-compl
175
174
.. ipython ::
176
175
:verbatim:
177
176
178
- In [15]: df.plot.<TAB>
177
+ In [15]: df.plot.<TAB> # noqa: E225, E999
179
178
df.plot.area df.plot.barh df.plot.density df.plot.hist df.plot.line df.plot.scatter
180
179
df.plot.bar df.plot.box df.plot.hexbin df.plot.kde df.plot.pie
181
180
@@ -261,7 +260,7 @@ incrementally.
261
260
262
261
.. code-block :: python
263
262
264
- for df in pd.read_sas(' sas_xport.xpt' , chunksize = 10000 )
263
+ for df in pd.read_sas(' sas_xport.xpt' , chunksize = 10000 ):
265
264
do_something(df)
266
265
267
266
See the :ref: `docs <io.sas >` for more details.
@@ -297,16 +296,16 @@ See the :ref:`documentation <io.excel>` for more details.
297
296
298
297
.. ipython :: python
299
298
300
- df = pd.DataFrame([[1 ,2 , 3 , 4 ], [5 ,6 , 7 , 8 ]],
301
- columns = pd.MultiIndex.from_product([[ ' foo ' , ' bar ' ],[ ' a ' , ' b ' ]],
302
- names = [' col1' , ' col2' ]),
303
- index = pd.MultiIndex.from_product([[' j' ], [' l' , ' k' ]],
304
- names = [' i1' , ' i2' ]))
299
+ df = pd.DataFrame([[1 , 2 , 3 , 4 ], [5 , 6 , 7 , 8 ]],
300
+ columns = pd.MultiIndex.from_product(
301
+ [[ ' foo ' , ' bar ' ], [ ' a ' , ' b ' ]], names = [' col1' , ' col2' ]),
302
+ index = pd.MultiIndex.from_product([[' j' ], [' l' , ' k' ]],
303
+ names = [' i1' , ' i2' ]))
305
304
306
305
df
307
306
df.to_excel(' test.xlsx' )
308
307
309
- df = pd.read_excel(' test.xlsx' , header = [0 ,1 ], index_col = [0 ,1 ])
308
+ df = pd.read_excel(' test.xlsx' , header = [0 , 1 ], index_col = [0 , 1 ])
310
309
df
311
310
312
311
.. ipython :: python
@@ -412,15 +411,15 @@ Other enhancements
412
411
413
412
.. ipython :: python
414
413
415
- foo = pd.Series([1 ,2 ], name = ' foo' )
416
- bar = pd.Series([1 ,2 ])
417
- baz = pd.Series([4 ,5 ])
414
+ foo = pd.Series([1 , 2 ], name = ' foo' )
415
+ bar = pd.Series([1 , 2 ])
416
+ baz = pd.Series([4 , 5 ])
418
417
419
418
Previous Behavior:
420
419
421
420
.. code-block :: ipython
422
421
423
- In [1] pd.concat([foo, bar, baz], 1)
422
+ In [1]: pd.concat([foo, bar, baz], 1)
424
423
Out[1]:
425
424
0 1 2
426
425
0 1 1 4
@@ -748,14 +747,14 @@ Previous Behavior:
748
747
749
748
.. code-block :: ipython
750
749
751
- In [5]: s== None
750
+ In [5]: s == None
752
751
TypeError: Could not compare <type 'NoneType'> type with Series
753
752
754
753
New Behavior:
755
754
756
755
.. ipython :: python
757
756
758
- s== None
757
+ s == None
759
758
760
759
Usually you simply want to know which values are null.
761
760
@@ -784,8 +783,8 @@ Previous Behavior:
784
783
785
784
.. ipython :: python
786
785
787
- df_with_missing = pd.DataFrame({' col1' :[0 , np.nan, 2 ],
788
- ' col2' :[1 , np.nan, np.nan]})
786
+ df_with_missing = pd.DataFrame({' col1' : [0 , np.nan, 2 ],
787
+ ' col2' : [1 , np.nan, np.nan]})
789
788
790
789
df_with_missing
791
790
@@ -817,8 +816,8 @@ New Behavior:
817
816
818
817
df_with_missing.to_hdf(' file.h5' ,
819
818
' df_with_missing' ,
820
- format = ' table' ,
821
- mode = ' w' )
819
+ format = ' table' ,
820
+ mode = ' w' )
822
821
823
822
pd.read_hdf(' file.h5' , ' df_with_missing' )
824
823
0 commit comments