@@ -5,11 +5,6 @@ v0.14.0 (May 31 , 2014)
55
66{{ header }}
77
8- .. ipython :: python
9- :suppress:
10-
11-
12-
138This is a major release from 0.13.1 and includes a small number of API changes, several new features,
149enhancements, and performance improvements along with a large number of bug fixes. We recommend that all
1510users upgrade to this version.
@@ -63,8 +58,9 @@ API changes
6358
6459 .. ipython :: python
6560
66- import pandas.DataFrame as DataFrame
67- dfl = DataFrame(np.random.randn(5 , 2 ), columns = list (' AB' ))
61+ import pandas as pd
62+
63+ dfl = pd.DataFrame(np.random.randn(5 , 2 ), columns = list (' AB' ))
6864 dfl
6965 dfl.iloc[:, 2 :3 ]
7066 dfl.iloc[:, 1 :3 ]
@@ -138,13 +134,11 @@ API changes
138134 .. ipython :: python
139135 :suppress:
140136
141- import pandas.MultiIndex as MultiIndex
142- import pandas.Series as Series
143137 np.random.seed(1234 )
144138 from itertools import product
145139 tuples = list (product((' a' , ' b' ), (' c' , ' d' )))
146- mi = MultiIndex.from_tuples(tuples)
147- df_multi = DataFrame(np.random.randn(4 , 2 ), index = mi)
140+ mi = pd. MultiIndex.from_tuples(tuples)
141+ df_multi = pd. DataFrame(np.random.randn(4 , 2 ), index = mi)
148142 tuple_ind = pd.Index(tuples, tupleize_cols = False )
149143 df_multi.index
150144
@@ -183,7 +177,7 @@ API changes
183177
184178 .. code-block :: ipython
185179
186- In [1]: df = DataFrame(np.random.randn(10, 4), columns=list('ABCD'))
180+ In [1]: df = pd. DataFrame(np.random.randn(10, 4), columns=list('ABCD'))
187181
188182 In [4]: covs = pd.rolling_cov(df[['A', 'B', 'C']],
189183 ....: df[['B', 'C', 'D']],
@@ -356,7 +350,7 @@ More consistent behaviour for some groupby methods:
356350
357351 .. ipython :: python
358352
359- df = DataFrame([[1 , np.nan], [1 , 4 ], [5 , 6 ]], columns = [' A' , ' B' ])
353+ df = pd. DataFrame([[1 , np.nan], [1 , 4 ], [5 , 6 ]], columns = [' A' , ' B' ])
360354 g = df.groupby(' A' )
361355 g.nth(0 )
362356
@@ -379,7 +373,7 @@ More consistent behaviour for some groupby methods:
379373
380374 .. ipython :: python
381375
382- df = DataFrame([[1 , np.nan], [1 , 4 ], [5 , 6 ], [5 , 8 ]], columns = [' A' , ' B' ])
376+ df = pd. DataFrame([[1 , np.nan], [1 , 4 ], [5 , 6 ], [5 , 8 ]], columns = [' A' , ' B' ])
383377 g = df.groupby(' A' )
384378 g.count()
385379 g.describe()
@@ -388,7 +382,7 @@ More consistent behaviour for some groupby methods:
388382
389383 .. ipython :: python
390384
391- df = DataFrame([[1 , np.nan], [1 , 4 ], [5 , 6 ], [5 , 8 ]], columns = [' A' , ' B' ])
385+ df = pd. DataFrame([[1 , np.nan], [1 , 4 ], [5 , 6 ], [5 , 8 ]], columns = [' A' , ' B' ])
392386 g = df.groupby(' A' , as_index = False )
393387 g.count()
394388 g.describe()
@@ -524,17 +518,17 @@ See also issues (:issue:`6134`, :issue:`4036`, :issue:`3057`, :issue:`2598`, :is
524518 def mklbl (prefix , n ):
525519 return [" %s%s " % (prefix, i) for i in range (n)]
526520
527- index = MultiIndex.from_product([mklbl(' A' , 4 ),
528- mklbl(' B' , 2 ),
529- mklbl(' C' , 4 ),
530- mklbl(' D' , 2 )])
531- columns = MultiIndex.from_tuples([(' a' , ' foo' ), (' a' , ' bar' ),
532- (' b' , ' foo' ), (' b' , ' bah' )],
533- names = [' lvl0' , ' lvl1' ])
534- df = DataFrame(np.arange(len (index) * len (columns)).reshape((len (index),
535- len (columns))),
536- index = index,
537- columns = columns).sort_index().sort_index(axis = 1 )
521+ index = pd. MultiIndex.from_product([mklbl(' A' , 4 ),
522+ mklbl(' B' , 2 ),
523+ mklbl(' C' , 4 ),
524+ mklbl(' D' , 2 )])
525+ columns = pd. MultiIndex.from_tuples([(' a' , ' foo' ), (' a' , ' bar' ),
526+ (' b' , ' foo' ), (' b' , ' bah' )],
527+ names = [' lvl0' , ' lvl1' ])
528+ df = pd. DataFrame(np.arange(len (index) * len (columns)).reshape((len (index),
529+ len (columns))),
530+ index = index,
531+ columns = columns).sort_index().sort_index(axis = 1 )
538532 df
539533
540534 Basic MultiIndex slicing using slices, lists, and labels.
@@ -682,25 +676,25 @@ Deprecations
682676 .. code-block :: ipython
683677
684678 # non-floating point indexes can only be indexed by integers / labels
685- In [1]: Series(1, np.arange(5))[3.0]
679+ In [1]: pd. Series(1, np.arange(5))[3.0]
686680 pandas/core/index.py:469: FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point
687681 Out[1]: 1
688682
689- In [2]: Series(1, np.arange(5)).iloc[3.0]
683+ In [2]: pd. Series(1, np.arange(5)).iloc[3.0]
690684 pandas/core/index.py:469: FutureWarning: scalar indexers for index type Int64Index should be integers and not floating point
691685 Out[2]: 1
692686
693- In [3]: Series(1, np.arange(5)).iloc[3.0:4]
687+ In [3]: pd. Series(1, np.arange(5)).iloc[3.0:4]
694688 pandas/core/index.py:527: FutureWarning: slice indexers when using iloc should be integers and not floating point
695689 Out[3]:
696690 3 1
697691 dtype: int64
698692
699693 # these are Float64Indexes, so integer or floating point is acceptable
700- In [4]: Series(1, np.arange(5.))[3]
694+ In [4]: pd. Series(1, np.arange(5.))[3]
701695 Out[4]: 1
702696
703- In [5]: Series(1, np.arange(5.))[3.0]
697+ In [5]: pd. Series(1, np.arange(5.))[3.0]
704698 Out[6]: 1
705699
706700 - Numpy 1.9 compat w.r.t. deprecation warnings (:issue: `6960 `)
@@ -753,13 +747,13 @@ Enhancements
753747
754748 .. ipython :: python
755749
756- Series({(' a' , ' b' ): 1 , (' a' , ' a' ): 0 ,
757- (' a' , ' c' ): 2 , (' b' , ' a' ): 3 , (' b' , ' b' ): 4 })
758- DataFrame({(' a' , ' b' ): {(' A' , ' B' ): 1 , (' A' , ' C' ): 2 },
759- (' a' , ' a' ): {(' A' , ' C' ): 3 , (' A' , ' B' ): 4 },
760- (' a' , ' c' ): {(' A' , ' B' ): 5 , (' A' , ' C' ): 6 },
761- (' b' , ' a' ): {(' A' , ' C' ): 7 , (' A' , ' B' ): 8 },
762- (' b' , ' b' ): {(' A' , ' D' ): 9 , (' A' , ' B' ): 10 }})
750+ pd. Series({(' a' , ' b' ): 1 , (' a' , ' a' ): 0 ,
751+ (' a' , ' c' ): 2 , (' b' , ' a' ): 3 , (' b' , ' b' ): 4 })
752+ pd. DataFrame({(' a' , ' b' ): {(' A' , ' B' ): 1 , (' A' , ' C' ): 2 },
753+ (' a' , ' a' ): {(' A' , ' C' ): 3 , (' A' , ' B' ): 4 },
754+ (' a' , ' c' ): {(' A' , ' B' ): 5 , (' A' , ' C' ): 6 },
755+ (' b' , ' a' ): {(' A' , ' C' ): 7 , (' A' , ' B' ): 8 },
756+ (' b' , ' b' ): {(' A' , ' D' ): 9 , (' A' , ' B' ): 10 }})
763757
764758 - Added the ``sym_diff `` method to ``Index `` (:issue: `5543 `)
765759- ``DataFrame.to_latex `` now takes a longtable keyword, which if True will return a table in a longtable environment. (:issue: `6617 `)
@@ -772,34 +766,34 @@ Enhancements
772766
773767 .. ipython :: python
774768
775- household = DataFrame({
776- ' household_id' : [1 , 2 , 3 ],
777- ' male' : [0 , 1 , 0 ],
778- ' wealth' : [196087.3 , 316478.7 , 294750 ]
779- },
780- columns = [' household_id' , ' male' , ' wealth' ]
781- ).set_index(' household_id' )
769+ household = pd. DataFrame({
770+ ' household_id' : [1 , 2 , 3 ],
771+ ' male' : [0 , 1 , 0 ],
772+ ' wealth' : [196087.3 , 316478.7 , 294750 ]
773+ },
774+ columns = [' household_id' , ' male' , ' wealth' ]
775+ ).set_index(' household_id' )
782776 household
783- portfolio = DataFrame({
784- ' household_id' : [1 , 2 , 2 , 3 , 3 , 3 , 4 ],
785- ' asset_id' : [" nl0000301109" ,
786- " nl0000289783" ,
787- " gb00b03mlx29" ,
788- " gb00b03mlx29" ,
789- " lu0197800237" ,
790- " nl0000289965" ,
791- np.nan],
792- ' name' : [" ABN Amro" ,
793- " Robeco" ,
794- " Royal Dutch Shell" ,
795- " Royal Dutch Shell" ,
796- " AAB Eastern Europe Equity Fund" ,
797- " Postbank BioTech Fonds" ,
798- np.nan],
799- ' share' : [1.0 , 0.4 , 0.6 , 0.15 , 0.6 , 0.25 , 1.0 ]
800- },
801- columns = [' household_id' , ' asset_id' , ' name' , ' share' ]
802- ).set_index([' household_id' , ' asset_id' ])
777+ portfolio = pd. DataFrame({
778+ ' household_id' : [1 , 2 , 2 , 3 , 3 , 3 , 4 ],
779+ ' asset_id' : [" nl0000301109" ,
780+ " nl0000289783" ,
781+ " gb00b03mlx29" ,
782+ " gb00b03mlx29" ,
783+ " lu0197800237" ,
784+ " nl0000289965" ,
785+ np.nan],
786+ ' name' : [" ABN Amro" ,
787+ " Robeco" ,
788+ " Royal Dutch Shell" ,
789+ " Royal Dutch Shell" ,
790+ " AAB Eastern Europe Equity Fund" ,
791+ " Postbank BioTech Fonds" ,
792+ np.nan],
793+ ' share' : [1.0 , 0.4 , 0.6 , 0.15 , 0.6 , 0.25 , 1.0 ]
794+ },
795+ columns = [' household_id' , ' asset_id' , ' name' , ' share' ]
796+ ).set_index([' household_id' , ' asset_id' ])
803797 portfolio
804798
805799 household.join(portfolio, how = ' inner' )
@@ -834,7 +828,7 @@ Enhancements
834828 .. ipython :: python
835829
836830 import datetime
837- df = DataFrame({
831+ df = pd. DataFrame({
838832 ' Branch' : ' A A A A A B' .split(),
839833 ' Buyer' : ' Carl Mark Carl Carl Joe Joe' .split(),
840834 ' Quantity' : [1 , 3 , 5 , 1 , 8 , 1 ],
@@ -857,9 +851,8 @@ Enhancements
857851
858852 .. ipython :: python
859853
860- import pandas.period_range as period_range
861- prng = period_range(' 2013-01-01 09:00' , periods = 100 , freq = ' H' )
862- ps = Series(np.random.randn(len (prng)), index = prng)
854+ prng = pd.period_range(' 2013-01-01 09:00' , periods = 100 , freq = ' H' )
855+ ps = pd.Series(np.random.randn(len (prng)), index = prng)
863856 ps
864857 ps[' 2013-01-02' ]
865858
0 commit comments