pandas 0.11.0.dev-9988e5f documentation

What’s New

These are new features and improvements of note in each release.

v0.10.1 (January 22, 2013)

This is a minor release from 0.10.0 and includes new features, enhancements, and bug fixes. In particular, there is substantial new HDFStore functionality contributed by Jeff Reback.

An undesired API breakage with functions taking the inplace option has been reverted and deprecation warnings added.

API changes

  • Functions taking an inplace option return the calling object as before. A deprecation message has been added
  • Groupby aggregations Max/Min no longer exclude non-numeric data (GH2700)
  • Resampling an empty DataFrame now returns an empty DataFrame instead of raising an exception (GH2640)
  • The file reader will now raise an exception when NA values are found in an explicitly specified integer column instead of converting the column to float (GH2631)
  • DatetimeIndex.unique now returns a DatetimeIndex with the same name and
  • timezone instead of an array (GH2563)

New features

  • MySQL support for database (contribution from Dan Allan)

HDFStore

You may need to upgrade your existing data files. Please visit the compatibility section in the main docs.

You can designate (and index) certain columns that you want to be able to perform queries on a table, by passing a list to data_columns

In [1530]: store = HDFStore('store.h5')

In [1531]: df = DataFrame(randn(8, 3), index=date_range('1/1/2000', periods=8),
   ......:            columns=['A', 'B', 'C'])
   ......:

In [1532]: df['string'] = 'foo'

In [1533]: df.ix[4:6,'string'] = np.nan

In [1534]: df.ix[7:9,'string'] = 'bar'

In [1535]: df['string2'] = 'cool'

In [1536]: df
Out[1536]: 
                   A         B         C string string2
2000-01-01  0.741687  0.035967 -2.700230    foo    cool
2000-01-02  0.777316  1.201654  0.775594    foo    cool
2000-01-03  0.916695 -0.511978  0.805595    foo    cool
2000-01-04 -0.517789 -0.980332 -1.325032    foo    cool
2000-01-05  0.015397  1.063654 -0.297355    NaN    cool
2000-01-06  1.118334 -1.750153  0.507924    NaN    cool
2000-01-07 -0.163195  0.285564 -0.332279    foo    cool
2000-01-08 -0.516040 -0.531297 -0.409554    bar    cool

# on-disk operations
In [1537]: store.append('df', df, data_columns = ['B','C','string','string2'])

In [1538]: store.select('df',[ 'B > 0', 'string == foo' ])
Out[1538]: 
                   A         B         C string string2
2000-01-01  0.741687  0.035967 -2.700230    foo    cool
2000-01-02  0.777316  1.201654  0.775594    foo    cool
2000-01-07 -0.163195  0.285564 -0.332279    foo    cool

# this is in-memory version of this type of selection
In [1539]: df[(df.B > 0) & (df.string == 'foo')]
Out[1539]: 
                   A         B         C string string2
2000-01-01  0.741687  0.035967 -2.700230    foo    cool
2000-01-02  0.777316  1.201654  0.775594    foo    cool
2000-01-07 -0.163195  0.285564 -0.332279    foo    cool

Retrieving unique values in an indexable or data column.

In [1540]: store.unique('df','index')
Out[1540]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-01 00:00:00, ..., 2000-01-08 00:00:00]
Length: 8, Freq: None, Timezone: None

In [1541]: store.unique('df','string')
Out[1541]: Index([bar, foo], dtype=object)

You can now store datetime64 in data columns

In [1542]: df_mixed               = df.copy()

In [1543]: df_mixed['datetime64'] = Timestamp('20010102')

In [1544]: df_mixed.ix[3:4,['A','B']] = np.nan

In [1545]: store.append('df_mixed', df_mixed)

In [1546]: df_mixed1 = store.select('df_mixed')

In [1547]: df_mixed1
Out[1547]: 
                   A         B         C string string2          datetime64
2000-01-01  0.741687  0.035967 -2.700230    foo    cool 2001-01-02 00:00:00
2000-01-02  0.777316  1.201654  0.775594    foo    cool 2001-01-02 00:00:00
2000-01-03  0.916695 -0.511978  0.805595    foo    cool 2001-01-02 00:00:00
2000-01-04       NaN       NaN -1.325032    foo    cool 2001-01-02 00:00:00
2000-01-05  0.015397  1.063654 -0.297355    NaN    cool 2001-01-02 00:00:00
2000-01-06  1.118334 -1.750153  0.507924    NaN    cool 2001-01-02 00:00:00
2000-01-07 -0.163195  0.285564 -0.332279    foo    cool 2001-01-02 00:00:00
2000-01-08 -0.516040 -0.531297 -0.409554    bar    cool 2001-01-02 00:00:00

In [1548]: df_mixed1.get_dtype_counts()
Out[1548]: 
datetime64[ns]    1
float64           3
object            2
dtype: int64

You can pass columns keyword to select to filter a list of the return columns, this is equivalent to passing a Term('columns',list_of_columns_to_filter)

In [1549]: store.select('df',columns = ['A','B'])
Out[1549]: 
                   A         B
2000-01-01  0.741687  0.035967
2000-01-02  0.777316  1.201654
2000-01-03  0.916695 -0.511978
2000-01-04 -0.517789 -0.980332
2000-01-05  0.015397  1.063654
2000-01-06  1.118334 -1.750153
2000-01-07 -0.163195  0.285564
2000-01-08 -0.516040 -0.531297

HDFStore now serializes multi-index dataframes when appending tables.

In [1550]: index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'],
   ......:                            ['one', 'two', 'three']],
   ......:                    labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3],
   ......:                            [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]],
   ......:                    names=['foo', 'bar'])
   ......:

In [1551]: df = DataFrame(np.random.randn(10, 3), index=index,
   ......:                columns=['A', 'B', 'C'])
   ......:

In [1552]: df
Out[1552]: 
                  A         B         C
foo bar                                
foo one    0.055458 -0.000871 -0.156757
    two   -1.193604  0.768787 -0.228047
    three  0.054979 -0.423256  0.175289
bar one   -0.961203 -0.302857  0.047525
    two   -0.987381 -0.082381  1.122844
baz two    0.357760 -1.287685 -0.555503
    three -1.721204 -0.040879 -1.742960
qux one   -1.263551 -0.952076  1.253998
    two   -0.994435 -1.857899 -1.409501
    three  2.056446  0.686683  0.295824

In [1553]: store.append('mi',df)

In [1554]: store.select('mi')
Out[1554]: 
                  A         B         C
foo bar                                
foo one    0.055458 -0.000871 -0.156757
    two   -1.193604  0.768787 -0.228047
    three  0.054979 -0.423256  0.175289
bar one   -0.961203 -0.302857  0.047525
    two   -0.987381 -0.082381  1.122844
baz two    0.357760 -1.287685 -0.555503
    three -1.721204 -0.040879 -1.742960
qux one   -1.263551 -0.952076  1.253998
    two   -0.994435 -1.857899 -1.409501
    three  2.056446  0.686683  0.295824

# the levels are automatically included as data columns
In [1555]: store.select('mi', Term('foo=bar'))
Out[1555]: 
                A         B         C
foo bar                              
bar one -0.961203 -0.302857  0.047525
    two -0.987381 -0.082381  1.122844

Multi-table creation via append_to_multiple and selection via select_as_multiple can create/select from multiple tables and return a combined result, by using where on a selector table.

In [1556]: df_mt = DataFrame(randn(8, 6), index=date_range('1/1/2000', periods=8),
   ......:                                columns=['A', 'B', 'C', 'D', 'E', 'F'])
   ......:

In [1557]: df_mt['foo'] = 'bar'

# you can also create the tables individually
In [1558]: store.append_to_multiple({ 'df1_mt' : ['A','B'], 'df2_mt' : None }, df_mt, selector = 'df1_mt')

In [1559]: store
Out[1559]: 
<class 'pandas.io.pytables.HDFStore'>
File path: store.h5
/df                  frame_table  (typ->appendable,nrows->8,ncols->5,indexers->[index],dc->[B,C,string,string2])
/df1_mt              frame_table  (typ->appendable,nrows->8,ncols->2,indexers->[index],dc->[A,B])               
/df2_mt              frame_table  (typ->appendable,nrows->8,ncols->5,indexers->[index])                         
/df_mixed            frame_table  (typ->appendable,nrows->8,ncols->6,indexers->[index])                         
/mi                  frame_table  (typ->appendable_multi,nrows->10,ncols->5,indexers->[index],dc->[bar,foo])    

# indiviual tables were created
In [1560]: store.select('df1_mt')
Out[1560]: 
                   A         B
2000-01-01  0.452273  0.853944
2000-01-02 -0.388093  0.086667
2000-01-03 -0.727640 -0.341083
2000-01-04  1.973282 -0.336809
2000-01-05  0.436261 -0.543731
2000-01-06 -0.068377 -0.215977
2000-01-07  1.203168  0.564612
2000-01-08 -0.414547  2.005601

In [1561]: store.select('df2_mt')
Out[1561]: 
                   C         D         E         F  foo
2000-01-01  0.585509  0.483793  1.387714 -0.261908  bar
2000-01-02  0.269055  0.011450 -0.104465 -0.406944  bar
2000-01-03  0.478604  0.463990  1.237388  0.628084  bar
2000-01-04  0.963953  0.053805  1.182483  0.566182  bar
2000-01-05 -0.320155  2.545145  0.301306  1.967739  bar
2000-01-06 -1.038566 -0.911641 -1.172296  1.539279  bar
2000-01-07 -0.836731  0.283662 -0.357312  1.295667  bar
2000-01-08 -0.601194 -0.134764  0.280262 -0.627031  bar

# as a multiple
In [1562]: store.select_as_multiple(['df1_mt','df2_mt'], where = [ 'A>0','B>0' ], selector = 'df1_mt')
Out[1562]: 
                   A         B         C         D         E         F  foo
2000-01-01  0.452273  0.853944  0.585509  0.483793  1.387714 -0.261908  bar
2000-01-07  1.203168  0.564612 -0.836731  0.283662 -0.357312  1.295667  bar

Enhancements

  • HDFStore now can read native PyTables table format tables
  • You can pass nan_rep = 'my_nan_rep' to append, to change the default nan representation on disk (which converts to/from np.nan), this defaults to nan.
  • You can pass index to append. This defaults to True. This will automagically create indicies on the indexables and data columns of the table
  • You can pass chunksize=an integer to append, to change the writing chunksize (default is 50000). This will signficantly lower your memory usage on writing.
  • You can pass expectedrows=an integer to the first append, to set the TOTAL number of expectedrows that PyTables will expected. This will optimize read/write performance.
  • Select now supports passing start and stop to provide selection space limiting in selection.
  • Greatly improved ISO8601 (e.g., yyyy-mm-dd) date parsing for file parsers (GH2698)
  • Allow DataFrame.merge to handle combinatorial sizes too large for 64-bit integer (GH2690)
  • Series now has unary negation (-series) and inversion (~series) operators (GH2686)
  • DataFrame.plot now includes a logx parameter to change the x-axis to log scale (GH2327)
  • Series arithmetic operators can now handle constant and ndarray input (GH2574)
  • ExcelFile now takes a kind argument to specify the file type (GH2613)
  • A faster implementation for Series.str methods (GH2602)

Bug Fixes

  • HDFStore tables can now store float32 types correctly (cannot be mixed with float64 however)
  • Fixed Google Analytics prefix when specifying request segment (GH2713).
  • Function to reset Google Analytics token store so users can recover from

improperly setup client secrets (GH2687_). - Fixed groupby bug resulting in segfault when passing in MultiIndex (GH2706) - Fixed bug where passing a Series with datetime64 values into to_datetime results in bogus output values (GH2699) - Fixed bug in pattern in HDFStore expressions when pattern is not a valid regex (GH2694) - Fixed performance issues while aggregating boolean data (GH2692) - When given a boolean mask key and a Series of new values, Series __setitem__ will now align the incoming values with the original Series (GH2686) - Fixed MemoryError caused by performing counting sort on sorting MultiIndex levels with a very large number of combinatorial values (GH2684) - Fixed bug that causes plotting to fail when the index is a DatetimeIndex with a fixed-offset timezone (GH2683) - Corrected businessday subtraction logic when the offset is more than 5 bdays and the starting date is on a weekend (GH2680) - Fixed C file parser behavior when the file has more columns than data (GH2668) - Fixed file reader bug that misaligned columns with data in the presence of an implicit column and a specified usecols value - DataFrames with numerical or datetime indices are now sorted prior to plotting (GH2609) - Fixed DataFrame.from_records error when passed columns, index, but empty records (GH2633) - Several bug fixed for Series operations when dtype is datetime64 (GH2689, GH2629, GH2626)

See the full release notes or issue tracker on GitHub for a complete list.

v0.10.0 (December 17, 2012)

This is a major release from 0.9.1 and includes many new features and enhancements along with a large number of bug fixes. There are also a number of important API changes that long-time pandas users should pay close attention to.

File parsing new features

The delimited file parsing engine (the guts of read_csv and read_table) has been rewritten from the ground up and now uses a fraction the amount of memory while parsing, while being 40% or more faster in most use cases (in some cases much faster).

There are also many new features:

  • Much-improved Unicode handling via the encoding option.
  • Column filtering (usecols)
  • Dtype specification (dtype argument)
  • Ability to specify strings to be recognized as True/False
  • Ability to yield NumPy record arrays (as_recarray)
  • High performance delim_whitespace option
  • Decimal format (e.g. European format) specification
  • Easier CSV dialect options: escapechar, lineterminator, quotechar, etc.
  • More robust handling of many exceptional kinds of files observed in the wild

API changes

Deprecated DataFrame BINOP TimeSeries special case behavior

The default behavior of binary operations between a DataFrame and a Series has always been to align on the DataFrame’s columns and broadcast down the rows, except in the special case that the DataFrame contains time series. Since there are now method for each binary operator enabling you to specify how you want to broadcast, we are phasing out this special case (Zen of Python: Special cases aren’t special enough to break the rules). Here’s what I’m talking about:

In [1563]: import pandas as pd

In [1564]: df = pd.DataFrame(np.random.randn(6, 4),
   ......:                   index=pd.date_range('1/1/2000', periods=6))
   ......:

In [1565]: df
Out[1565]: 
                   0         1         2         3
2000-01-01  1.197755  0.443238 -0.793423  0.450845
2000-01-02 -0.833944  1.497871 -0.062647  0.156242
2000-01-03  0.752988  1.193476 -1.622707  0.924629
2000-01-04  0.865121 -0.192174 -0.924645  1.035467
2000-01-05 -0.237298 -0.193078 -0.113703 -1.510585
2000-01-06  0.426243 -0.863411  0.386999  1.318817

# deprecated now
In [1566]: df - df[0]
Out[1566]: 
            0         1         2         3
2000-01-01  0 -0.754517 -1.991178 -0.746911
2000-01-02  0  2.331815  0.771297  0.990186
2000-01-03  0  0.440488 -2.375695  0.171640
2000-01-04  0 -1.057295 -1.789767  0.170346
2000-01-05  0  0.044219  0.123595 -1.273288
2000-01-06  0 -1.289654 -0.039243  0.892574

# Change your code to
In [1567]: df.sub(df[0], axis=0) # align on axis 0 (rows)
Out[1567]: 
            0         1         2         3
2000-01-01  0 -0.754517 -1.991178 -0.746911
2000-01-02  0  2.331815  0.771297  0.990186
2000-01-03  0  0.440488 -2.375695  0.171640
2000-01-04  0 -1.057295 -1.789767  0.170346
2000-01-05  0  0.044219  0.123595 -1.273288
2000-01-06  0 -1.289654 -0.039243  0.892574

You will get a deprecation warning in the 0.10.x series, and the deprecated functionality will be removed in 0.11 or later.

Altered resample default behavior

The default time series resample binning behavior of daily D and higher frequencies has been changed to closed='left', label='left'. Lower nfrequencies are unaffected. The prior defaults were causing a great deal of confusion for users, especially resampling data to daily frequency (which labeled the aggregated group with the end of the interval: the next day).

Note:

In [1568]: dates = pd.date_range('1/1/2000', '1/5/2000', freq='4h')

In [1569]: series = Series(np.arange(len(dates)), index=dates)

In [1570]: series
Out[1570]: 
2000-01-01 00:00:00     0
2000-01-01 04:00:00     1
2000-01-01 08:00:00     2
2000-01-01 12:00:00     3
2000-01-01 16:00:00     4
2000-01-01 20:00:00     5
2000-01-02 00:00:00     6
2000-01-02 04:00:00     7
2000-01-02 08:00:00     8
2000-01-02 12:00:00     9
2000-01-02 16:00:00    10
2000-01-02 20:00:00    11
2000-01-03 00:00:00    12
2000-01-03 04:00:00    13
2000-01-03 08:00:00    14
2000-01-03 12:00:00    15
2000-01-03 16:00:00    16
2000-01-03 20:00:00    17
2000-01-04 00:00:00    18
2000-01-04 04:00:00    19
2000-01-04 08:00:00    20
2000-01-04 12:00:00    21
2000-01-04 16:00:00    22
2000-01-04 20:00:00    23
2000-01-05 00:00:00    24
Freq: 4H, dtype: int64

In [1571]: series.resample('D', how='sum')
Out[1571]: 
2000-01-01     15
2000-01-02     51
2000-01-03     87
2000-01-04    123
2000-01-05     24
Freq: D, dtype: float64

# old behavior
In [1572]: series.resample('D', how='sum', closed='right', label='right')
Out[1572]: 
2000-01-01      0
2000-01-02     21
2000-01-03     57
2000-01-04     93
2000-01-05    129
Freq: D, dtype: float64
  • Infinity and negative infinity are no longer treated as NA by isnull and notnull. That they every were was a relic of early pandas. This behavior can be re-enabled globally by the mode.use_inf_as_null option:
In [1573]: s = pd.Series([1.5, np.inf, 3.4, -np.inf])

In [1574]: pd.isnull(s)
Out[1574]: 
0    False
1    False
2    False
3    False
dtype: bool

In [1575]: s.fillna(0)
Out[1575]: 
0    1.500000
1         inf
2    3.400000
3        -inf
dtype: float64

In [1576]: pd.set_option('use_inf_as_null', True)

In [1577]: pd.isnull(s)
Out[1577]: 
0    False
1     True
2    False
3     True
dtype: bool

In [1578]: s.fillna(0)
Out[1578]: 
0    1.5
1    0.0
2    3.4
3    0.0
dtype: float64

In [1579]: pd.reset_option('use_inf_as_null')
  • Methods with the inplace option now all return None instead of the calling object. E.g. code written like df = df.fillna(0, inplace=True) may stop working. To fix, simply delete the unnecessary variable assignment.
  • pandas.merge no longer sorts the group keys (sort=False) by default. This was done for performance reasons: the group-key sorting is often one of the more expensive parts of the computation and is often unnecessary.
  • The default column names for a file with no header have been changed to the integers 0 through N - 1. This is to create consistency with the DataFrame constructor with no columns specified. The v0.9.0 behavior (names X0, X1, ...) can be reproduced by specifying prefix='X':
In [1580]: data= 'a,b,c\n1,Yes,2\n3,No,4'

In [1581]: print data
a,b,c
1,Yes,2
3,No,4

In [1582]: pd.read_csv(StringIO(data), header=None)
Out[1582]: 
   0    1  2
0  a    b  c
1  1  Yes  2
2  3   No  4

In [1583]: pd.read_csv(StringIO(data), header=None, prefix='X')
Out[1583]: 
  X0   X1 X2
0  a    b  c
1  1  Yes  2
2  3   No  4
  • Values like 'Yes' and 'No' are not interpreted as boolean by default, though this can be controlled by new true_values and false_values arguments:
In [1584]: print data
a,b,c
1,Yes,2
3,No,4

In [1585]: pd.read_csv(StringIO(data))
Out[1585]: 
   a    b  c
0  1  Yes  2
1  3   No  4

In [1586]: pd.read_csv(StringIO(data), true_values=['Yes'], false_values=['No'])
Out[1586]: 
   a      b  c
0  1   True  2
1  3  False  4
  • The file parsers will not recognize non-string values arising from a converter function as NA if passed in the na_values argument. It’s better to do post-processing using the replace function instead.
  • Calling fillna on Series or DataFrame with no arguments is no longer valid code. You must either specify a fill value or an interpolation method:
In [1587]: s = Series([np.nan, 1., 2., np.nan, 4])

In [1588]: s
Out[1588]: 
0   NaN
1     1
2     2
3   NaN
4     4
dtype: float64

In [1589]: s.fillna(0)
Out[1589]: 
0    0
1    1
2    2
3    0
4    4
dtype: float64

In [1590]: s.fillna(method='pad')
Out[1590]: 
0   NaN
1     1
2     2
3     2
4     4
dtype: float64

Convenience methods ffill and bfill have been added:

In [1591]: s.ffill()
Out[1591]: 
0   NaN
1     1
2     2
3     2
4     4
dtype: float64
  • Series.apply will now operate on a returned value from the applied function, that is itself a series, and possibly upcast the result to a DataFrame

    In [1592]: def f(x):
       ......:     return Series([ x, x**2 ], index = ['x', 'x^2'])
       ......:
    
    In [1593]: s = Series(np.random.rand(5))
    
    In [1594]: s
    Out[1594]: 
    0    0.713026
    1    0.539601
    2    0.046682
    3    0.536308
    4    0.373040
    dtype: float64
    
    In [1595]: s.apply(f)
    Out[1595]: 
              x       x^2
    0  0.713026  0.508406
    1  0.539601  0.291170
    2  0.046682  0.002179
    3  0.536308  0.287626
    4  0.373040  0.139159
    
  • New API functions for working with pandas options (GH2097):

    • get_option / set_option - get/set the value of an option. Partial names are accepted. - reset_option - reset one or more options to their default value. Partial names are accepted. - describe_option - print a description of one or more options. When called with no arguments. print all registered options.

    Note: set_printoptions/ reset_printoptions are now deprecated (but functioning), the print options now live under “display.XYZ”. For example:

    In [1596]: get_option("display.max_rows")
    Out[1596]: 100
    
  • to_string() methods now always return unicode strings (GH2224).

New features

Wide DataFrame Printing

Instead of printing the summary information, pandas now splits the string representation across multiple rows by default:

In [1597]: wide_frame = DataFrame(randn(5, 16))

In [1598]: wide_frame
Out[1598]: 
         0         1         2         3         4         5         6         7   \
0  0.091848 -0.318810  0.950676 -1.016290 -0.267508  0.115960 -0.615949 -0.373060   
1 -0.234083 -0.254881 -0.142302  1.291962  0.876700  1.704647  0.046376  0.158167   
2  0.191589 -0.243287  1.684079 -0.637764 -0.323699 -1.378458 -0.868599  1.916736   
3  1.247851  0.246737  1.454094 -1.166264 -0.560671  1.027488  0.252915 -0.154549   
4 -0.417236  1.721160 -0.058702 -1.297767  0.871349 -0.177241  0.207366  2.592691   
         8         9         10        11        12        13        14        15  
0  0.276398 -1.947432 -1.183044 -3.030491 -1.055515 -0.177967  1.269136  0.668999  
1  1.503229 -0.335678  0.157359  0.828373  0.860863  0.618679 -0.507624 -1.174443  
2  1.562215  0.133322  0.345906 -1.778234 -1.223208 -0.480258 -0.285245  0.775414  
3  0.181686 -0.268458 -0.124345  0.443256 -0.778424  2.147255 -0.731309  0.281577  
4  0.423204 -0.006209  0.314186  0.363193  0.196151 -1.598514 -0.843566 -0.353828  

The old behavior of printing out summary information can be achieved via the ‘expand_frame_repr’ print option:

In [1599]: pd.set_option('expand_frame_repr', False)

In [1600]: wide_frame
Out[1600]: 
<class 'pandas.core.frame.DataFrame'>
Int64Index: 5 entries, 0 to 4
Data columns:
0     5  non-null values
1     5  non-null values
2     5  non-null values
3     5  non-null values
4     5  non-null values
5     5  non-null values
6     5  non-null values
7     5  non-null values
8     5  non-null values
9     5  non-null values
10    5  non-null values
11    5  non-null values
12    5  non-null values
13    5  non-null values
14    5  non-null values
15    5  non-null values
dtypes: float64(16)

The width of each line can be changed via ‘line_width’ (80 by default):

In [1601]: pd.set_option('line_width', 40)

In [1602]: wide_frame
Out[1602]: 
         0         1         2         3   \
0  0.091848 -0.318810  0.950676 -1.016290   
1 -0.234083 -0.254881 -0.142302  1.291962   
2  0.191589 -0.243287  1.684079 -0.637764   
3  1.247851  0.246737  1.454094 -1.166264   
4 -0.417236  1.721160 -0.058702 -1.297767   
         4         5         6         7   \
0 -0.267508  0.115960 -0.615949 -0.373060   
1  0.876700  1.704647  0.046376  0.158167   
2 -0.323699 -1.378458 -0.868599  1.916736   
3 -0.560671  1.027488  0.252915 -0.154549   
4  0.871349 -0.177241  0.207366  2.592691   
         8         9         10        11  \
0  0.276398 -1.947432 -1.183044 -3.030491   
1  1.503229 -0.335678  0.157359  0.828373   
2  1.562215  0.133322  0.345906 -1.778234   
3  0.181686 -0.268458 -0.124345  0.443256   
4  0.423204 -0.006209  0.314186  0.363193   
         12        13        14        15  
0 -1.055515 -0.177967  1.269136  0.668999  
1  0.860863  0.618679 -0.507624 -1.174443  
2 -1.223208 -0.480258 -0.285245  0.775414  
3 -0.778424  2.147255 -0.731309  0.281577  
4  0.196151 -1.598514 -0.843566 -0.353828  

Updated PyTables Support

Docs for PyTables Table format & several enhancements to the api. Here is a taste of what to expect.

In [1603]: store = HDFStore('store.h5')

In [1604]: df = DataFrame(randn(8, 3), index=date_range('1/1/2000', periods=8),
   ......:            columns=['A', 'B', 'C'])
   ......:

In [1605]: df
Out[1605]: 
                   A         B         C
2000-01-01  0.516740 -2.335539 -0.715006
2000-01-02 -0.399224  0.798589  2.101702
2000-01-03 -0.190649  0.595370 -1.672567
2000-01-04  0.786765  0.133175 -1.077265
2000-01-05  0.861068  1.982854 -1.059177
2000-01-06  2.050701 -0.615165 -0.601019
2000-01-07 -1.062777 -1.577586 -0.585584
2000-01-08  1.833699 -0.483165  0.652315

# appending data frames
In [1606]: df1 = df[0:4]

In [1607]: df2 = df[4:]

In [1608]: store.append('df', df1)

In [1609]: store.append('df', df2)

In [1610]: store
Out[1610]: 
<class 'pandas.io.pytables.HDFStore'>
File path: store.h5
/df            frame_table  (typ->appendable,nrows->8,ncols->3,indexers->[index])

# selecting the entire store
In [1611]: store.select('df')
Out[1611]: 
                   A         B         C
2000-01-01  0.516740 -2.335539 -0.715006
2000-01-02 -0.399224  0.798589  2.101702
2000-01-03 -0.190649  0.595370 -1.672567
2000-01-04  0.786765  0.133175 -1.077265
2000-01-05  0.861068  1.982854 -1.059177
2000-01-06  2.050701 -0.615165 -0.601019
2000-01-07 -1.062777 -1.577586 -0.585584
2000-01-08  1.833699 -0.483165  0.652315
In [1612]: wp = Panel(randn(2, 5, 4), items=['Item1', 'Item2'],
   ......:        major_axis=date_range('1/1/2000', periods=5),
   ......:        minor_axis=['A', 'B', 'C', 'D'])
   ......:

In [1613]: wp
Out[1613]: 
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 5 (major_axis) x 4 (minor_axis)
Items axis: Item1 to Item2
Major_axis axis: 2000-01-01 00:00:00 to 2000-01-05 00:00:00
Minor_axis axis: A to D

# storing a panel
In [1614]: store.append('wp',wp)

# selecting via A QUERY
In [1615]: store.select('wp',
   ......:   [ Term('major_axis>20000102'), Term('minor_axis', '=', ['A','B']) ])
   ......:
Out[1615]: 
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 3 (major_axis) x 2 (minor_axis)
Items axis: Item1 to Item2
Major_axis axis: 2000-01-03 00:00:00 to 2000-01-05 00:00:00
Minor_axis axis: A to B

# removing data from tables
In [1616]: store.remove('wp', [ 'major_axis', '>', wp.major_axis[3] ])
Out[1616]: 4

In [1617]: store.select('wp')
Out[1617]: 
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 4 (major_axis) x 4 (minor_axis)
Items axis: Item1 to Item2
Major_axis axis: 2000-01-01 00:00:00 to 2000-01-04 00:00:00
Minor_axis axis: A to D

# deleting a store
In [1618]: del store['df']

In [1619]: store
Out[1619]: 
<class 'pandas.io.pytables.HDFStore'>
File path: store.h5
/wp            wide_table   (typ->appendable,nrows->16,ncols->2,indexers->[major_axis,minor_axis])

Enhancements

  • added ability to hierarchical keys

    In [1620]: store.put('foo/bar/bah', df)
    
    In [1621]: store.append('food/orange', df)
    
    In [1622]: store.append('food/apple',  df)
    
    In [1623]: store
    Out[1623]: 
    <class 'pandas.io.pytables.HDFStore'>
    File path: store.h5
    /wp                     wide_table   (typ->appendable,nrows->16,ncols->2,indexers->[major_axis,minor_axis])
    /food/apple             frame_table  (typ->appendable,nrows->8,ncols->3,indexers->[index])                 
    /food/orange            frame_table  (typ->appendable,nrows->8,ncols->3,indexers->[index])                 
    /foo/bar/bah            frame        (shape->[8,3])                                                        
    
    # remove all nodes under this level
    In [1624]: store.remove('food')
    
    In [1625]: store
    Out[1625]: 
    <class 'pandas.io.pytables.HDFStore'>
    File path: store.h5
    /wp                     wide_table   (typ->appendable,nrows->16,ncols->2,indexers->[major_axis,minor_axis])
    /foo/bar/bah            frame        (shape->[8,3])                                                        
    
  • added mixed-dtype support!

    In [1626]: df['string'] = 'string'
    
    In [1627]: df['int']    = 1
    
    In [1628]: store.append('df',df)
    
    In [1629]: df1 = store.select('df')
    
    In [1630]: df1
    Out[1630]: 
                       A         B         C  string  int
    2000-01-01  0.516740 -2.335539 -0.715006  string    1
    2000-01-02 -0.399224  0.798589  2.101702  string    1
    2000-01-03 -0.190649  0.595370 -1.672567  string    1
    2000-01-04  0.786765  0.133175 -1.077265  string    1
    2000-01-05  0.861068  1.982854 -1.059177  string    1
    2000-01-06  2.050701 -0.615165 -0.601019  string    1
    2000-01-07 -1.062777 -1.577586 -0.585584  string    1
    2000-01-08  1.833699 -0.483165  0.652315  string    1
    
    In [1631]: df1.get_dtype_counts()
    Out[1631]: 
    float64    3
    int64      1
    object     1
    dtype: int64
    
  • performance improvments on table writing

  • support for arbitrarily indexed dimensions

  • SparseSeries now has a density property (GH2384)

  • enable Series.str.strip/lstrip/rstrip methods to take an input argument to strip arbitrary characters (GH2411)

  • implement value_vars in melt to limit values to certain columns and add melt to pandas namespace (GH2412)

Bug Fixes

  • added Term method of specifying where conditions (GH1996).
  • del store['df'] now call store.remove('df') for store deletion
  • deleting of consecutive rows is much faster than before
  • min_itemsize parameter can be specified in table creation to force a minimum size for indexing columns (the previous implementation would set the column size based on the first append)
  • indexing support via create_table_index (requires PyTables >= 2.3) (GH698).
  • appending on a store would fail if the table was not first created via put
  • fixed issue with missing attributes after loading a pickled dataframe (GH2431)
  • minor change to select and remove: require a table ONLY if where is also provided (and not None)

Compatibility

0.10 of HDFStore is backwards compatible for reading tables created in a prior version of pandas, however, query terms using the prior (undocumented) methodology are unsupported. You must read in the entire file and write it out using the new format to take advantage of the updates.

N Dimensional Panels (Experimental)

Adding experimental support for Panel4D and factory functions to create n-dimensional named panels. Docs for NDim. Here is a taste of what to expect.

In [1632]: p4d = Panel4D(randn(2, 2, 5, 4),
   ......:       labels=['Label1','Label2'],
   ......:       items=['Item1', 'Item2'],
   ......:       major_axis=date_range('1/1/2000', periods=5),
   ......:       minor_axis=['A', 'B', 'C', 'D'])
   ......:

In [1633]: p4d
Out[1633]: 
<class 'pandas.core.panelnd.Panel4D'>
Dimensions: 2 (labels) x 2 (items) x 5 (major_axis) x 4 (minor_axis)
Labels axis: Label1 to Label2
Items axis: Item1 to Item2
Major_axis axis: 2000-01-01 00:00:00 to 2000-01-05 00:00:00
Minor_axis axis: A to D

See the full release notes or issue tracker on GitHub for a complete list.

v0.9.1 (November 14, 2012)

This is a bugfix release from 0.9.0 and includes several new features and enhancements along with a large number of bug fixes. The new features include by-column sort order for DataFrame and Series, improved NA handling for the rank method, masking functions for DataFrame, and intraday time-series filtering for DataFrame.

New features

  • Series.sort, DataFrame.sort, and DataFrame.sort_index can now be specified in a per-column manner to support multiple sort orders (GH928)

    In [1634]: df = DataFrame(np.random.randint(0, 2, (6, 3)), columns=['A', 'B', 'C'])
    
    In [1635]: df.sort(['A', 'B'], ascending=[1, 0])
    Out[1635]: 
       A  B  C
    1  0  1  0
    2  1  1  0
    3  1  1  1
    4  1  1  0
    0  1  0  1
    5  1  0  1
    
  • DataFrame.rank now supports additional argument values for the na_option parameter so missing values can be assigned either the largest or the smallest rank (GH1508, GH2159)

    In [1636]: df = DataFrame(np.random.randn(6, 3), columns=['A', 'B', 'C'])
    
    In [1637]: df.ix[2:4] = np.nan
    
    In [1638]: df.rank()
    Out[1638]: 
        A   B   C
    0   1   3   2
    1   2   1   1
    2 NaN NaN NaN
    3 NaN NaN NaN
    4 NaN NaN NaN
    5   3   2   3
    
    In [1639]: df.rank(na_option='top')
    Out[1639]: 
       A  B  C
    0  4  6  5
    1  5  4  4
    2  2  2  2
    3  2  2  2
    4  2  2  2
    5  6  5  6
    
    In [1640]: df.rank(na_option='bottom')
    Out[1640]: 
       A  B  C
    0  1  3  2
    1  2  1  1
    2  5  5  5
    3  5  5  5
    4  5  5  5
    5  3  2  3
    
  • DataFrame has new where and mask methods to select values according to a given boolean mask (GH2109, GH2151)

    DataFrame currently supports slicing via a boolean vector the same length as the DataFrame (inside the []). The returned DataFrame has the same number of columns as the original, but is sliced on its index.

    In [1641]: df = DataFrame(np.random.randn(5, 3), columns = ['A','B','C'])
    
    In [1642]: df
    Out[1642]: 
              A         B         C
    0 -1.381185  0.365239 -1.810632
    1 -0.673382 -1.967580 -0.401183
    2 -0.583047 -0.998625 -0.629277
    3 -0.548001 -0.852612 -0.126250
    4  1.765997 -1.593297 -0.966162
    
    In [1643]: df[df['A'] > 0]
    Out[1643]: 
              A         B         C
    4  1.765997 -1.593297 -0.966162
    

    If a DataFrame is sliced with a DataFrame based boolean condition (with the same size as the original DataFrame), then a DataFrame the same size (index and columns) as the original is returned, with elements that do not meet the boolean condition as NaN. This is accomplished via the new method DataFrame.where. In addition, where takes an optional other argument for replacement.

    In [1644]: df[df>0]
    Out[1644]: 
              A         B   C
    0       NaN  0.365239 NaN
    1       NaN       NaN NaN
    2       NaN       NaN NaN
    3       NaN       NaN NaN
    4  1.765997       NaN NaN
    
    In [1645]: df.where(df>0)
    Out[1645]: 
              A         B   C
    0       NaN  0.365239 NaN
    1       NaN       NaN NaN
    2       NaN       NaN NaN
    3       NaN       NaN NaN
    4  1.765997       NaN NaN
    
    In [1646]: df.where(df>0,-df)
    Out[1646]: 
              A         B         C
    0  1.381185  0.365239  1.810632
    1  0.673382  1.967580  0.401183
    2  0.583047  0.998625  0.629277
    3  0.548001  0.852612  0.126250
    4  1.765997  1.593297  0.966162
    

    Furthermore, where now aligns the input boolean condition (ndarray or DataFrame), such that partial selection with setting is possible. This is analagous to partial setting via .ix (but on the contents rather than the axis labels)

    In [1647]: df2 = df.copy()
    
    In [1648]: df2[ df2[1:4] > 0 ] = 3
    
    In [1649]: df2
    Out[1649]: 
              A         B         C
    0 -1.381185  0.365239 -1.810632
    1 -0.673382 -1.967580 -0.401183
    2 -0.583047 -0.998625 -0.629277
    3 -0.548001 -0.852612 -0.126250
    4  1.765997 -1.593297 -0.966162
    

    DataFrame.mask is the inverse boolean operation of where.

    In [1650]: df.mask(df<=0)
    Out[1650]: 
              A         B   C
    0       NaN  0.365239 NaN
    1       NaN       NaN NaN
    2       NaN       NaN NaN
    3       NaN       NaN NaN
    4  1.765997       NaN NaN
    
  • Enable referencing of Excel columns by their column names (GH1936)

    In [1651]: xl = ExcelFile('data/test.xls')
    
    In [1652]: xl.parse('Sheet1', index_col=0, parse_dates=True,
       ......:          parse_cols='A:D')
       ......:
    Out[1652]: 
                       A         B         C
    2000-01-03  0.980269  3.685731 -0.364217
    2000-01-04  1.047916 -0.041232 -0.161812
    2000-01-05  0.498581  0.731168 -0.537677
    2000-01-06  1.120202  1.567621  0.003641
    2000-01-07 -0.487094  0.571455 -1.611639
    2000-01-10  0.836649  0.246462  0.588543
    2000-01-11 -0.157161  1.340307  1.195778
    
  • Added option to disable pandas-style tick locators and formatters using series.plot(x_compat=True) or pandas.plot_params[‘x_compat’] = True (GH2205)

  • Existing TimeSeries methods at_time and between_time were added to DataFrame (GH2149)

  • DataFrame.dot can now accept ndarrays (GH2042)

  • DataFrame.drop now supports non-unique indexes (GH2101)

  • Panel.shift now supports negative periods (GH2164)

  • DataFrame now support unary ~ operator (GH2110)

API changes

  • Upsampling data with a PeriodIndex will result in a higher frequency TimeSeries that spans the original time window

    In [1653]: prng = period_range('2012Q1', periods=2, freq='Q')
    
    In [1654]: s = Series(np.random.randn(len(prng)), prng)
    
    In [1655]: s.resample('M')
    Out[1655]: 
    2012-01   -0.332601
    2012-02         NaN
    2012-03         NaN
    2012-04   -1.327330
    2012-05         NaN
    2012-06         NaN
    Freq: M, dtype: float64
    
  • Period.end_time now returns the last nanosecond in the time interval (GH2124, GH2125, GH1764)

    In [1656]: p = Period('2012')
    
    In [1657]: p.end_time
    Out[1657]: <Timestamp: 2012-12-31 23:59:59.999999999>
    
  • File parsers no longer coerce to float or bool for columns that have custom converters specified (GH2184)

    In [1658]: data = 'A,B,C\n00001,001,5\n00002,002,6'
    
    In [1659]: from cStringIO import StringIO
    
    In [1660]: read_csv(StringIO(data), converters={'A' : lambda x: x.strip()})
    Out[1660]: 
           A  B  C
    0  00001  1  5
    1  00002  2  6
    

See the full release notes or issue tracker on GitHub for a complete list.

v0.9.0 (October 7, 2012)

This is a major release from 0.8.1 and includes several new features and enhancements along with a large number of bug fixes. New features include vectorized unicode encoding/decoding for Series.str, to_latex method to DataFrame, more flexible parsing of boolean values, and enabling the download of options data from Yahoo! Finance.

New features

  • Add encode and decode for unicode handling to vectorized string processing methods in Series.str (GH1706)
  • Add DataFrame.to_latex method (GH1735)
  • Add convenient expanding window equivalents of all rolling_* ops (GH1785)
  • Add Options class to pandas.io.data for fetching options data from Yahoo! Finance (GH1748, GH1739)
  • More flexible parsing of boolean values (Yes, No, TRUE, FALSE, etc) (GH1691, GH1295)
  • Add level parameter to Series.reset_index
  • TimeSeries.between_time can now select times across midnight (GH1871)
  • Series constructor can now handle generator as input (GH1679)
  • DataFrame.dropna can now take multiple axes (tuple/list) as input (GH924)
  • Enable skip_footer parameter in ExcelFile.parse (GH1843)

API changes

  • The default column names when header=None and no columns names passed to functions like read_csv has changed to be more Pythonic and amenable to attribute access:
In [1661]: from StringIO import StringIO

In [1662]: data = '0,0,1\n1,1,0\n0,1,0'

In [1663]: df = read_csv(StringIO(data), header=None)

In [1664]: df
Out[1664]: 
   0  1  2
0  0  0  1
1  1  1  0
2  0  1  0
  • Creating a Series from another Series, passing an index, will cause reindexing to happen inside rather than treating the Series like an ndarray. Technically improper usages like Series(df[col1], index=df[col2]) that worked before “by accident” (this was never intended) will lead to all NA Series in some cases. To be perfectly clear:
In [1665]: s1 = Series([1, 2, 3])

In [1666]: s1
Out[1666]: 
0    1
1    2
2    3
dtype: int64

In [1667]: s2 = Series(s1, index=['foo', 'bar', 'baz'])

In [1668]: s2
Out[1668]: 
foo   NaN
bar   NaN
baz   NaN
dtype: float64
  • Deprecated day_of_year API removed from PeriodIndex, use dayofyear (GH1723)
  • Don’t modify NumPy suppress printoption to True at import time
  • The internal HDF5 data arrangement for DataFrames has been transposed. Legacy files will still be readable by HDFStore (GH1834, GH1824)
  • Legacy cruft removed: pandas.stats.misc.quantileTS
  • Use ISO8601 format for Period repr: monthly, daily, and on down (GH1776)
  • Empty DataFrame columns are now created as object dtype. This will prevent a class of TypeErrors that was occurring in code where the dtype of a column would depend on the presence of data or not (e.g. a SQL query having results) (GH1783)
  • Setting parts of DataFrame/Panel using ix now aligns input Series/DataFrame (GH1630)
  • first and last methods in GroupBy no longer drop non-numeric columns (GH1809)
  • Resolved inconsistencies in specifying custom NA values in text parser. na_values of type dict no longer override default NAs unless keep_default_na is set to false explicitly (GH1657)
  • DataFrame.dot will not do data alignment, and also work with Series (GH1915)

See the full release notes or issue tracker on GitHub for a complete list.

v0.8.1 (July 22, 2012)

This release includes a few new features, performance enhancements, and over 30 bug fixes from 0.8.0. New features include notably NA friendly string processing functionality and a series of new plot types and options.

New features

Performance improvements

  • Improved implementation of rolling min and max (thanks to Bottleneck !)
  • Add accelerated 'median' GroupBy option (GH1358)
  • Significantly improve the performance of parsing ISO8601-format date strings with DatetimeIndex or to_datetime (GH1571)
  • Improve the performance of GroupBy on single-key aggregations and use with Categorical types
  • Significant datetime parsing performance improvments

v0.8.0 (June 29, 2012)

This is a major release from 0.7.3 and includes extensive work on the time series handling and processing infrastructure as well as a great deal of new functionality throughout the library. It includes over 700 commits from more than 20 distinct authors. Most pandas 0.7.3 and earlier users should not experience any issues upgrading, but due to the migration to the NumPy datetime64 dtype, there may be a number of bugs and incompatibilities lurking. Lingering incompatibilities will be fixed ASAP in a 0.8.1 release if necessary. See the full release notes or issue tracker on GitHub for a complete list.

Support for non-unique indexes

All objects can now work with non-unique indexes. Data alignment / join operations work according to SQL join semantics (including, if application, index duplication in many-to-many joins)

NumPy datetime64 dtype and 1.6 dependency

Time series data are now represented using NumPy’s datetime64 dtype; thus, pandas 0.8.0 now requires at least NumPy 1.6. It has been tested and verified to work with the development version (1.7+) of NumPy as well which includes some significant user-facing API changes. NumPy 1.6 also has a number of bugs having to do with nanosecond resolution data, so I recommend that you steer clear of NumPy 1.6’s datetime64 API functions (though limited as they are) and only interact with this data using the interface that pandas provides.

See the end of the 0.8.0 section for a “porting” guide listing potential issues for users migrating legacy codebases from pandas 0.7 or earlier to 0.8.0.

Bug fixes to the 0.7.x series for legacy NumPy < 1.6 users will be provided as they arise. There will be no more further development in 0.7.x beyond bug fixes.

Time series changes and improvements

Note

With this release, legacy scikits.timeseries users should be able to port their code to use pandas.

Note

See documentation for overview of pandas timeseries API.

  • New datetime64 representation speeds up join operations and data alignment, reduces memory usage, and improve serialization / deserialization performance significantly over datetime.datetime
  • High performance and flexible resample method for converting from high-to-low and low-to-high frequency. Supports interpolation, user-defined aggregation functions, and control over how the intervals and result labeling are defined. A suite of high performance Cython/C-based resampling functions (including Open-High-Low-Close) have also been implemented.
  • Revamp of frequency aliases and support for frequency shortcuts like ‘15min’, or ‘1h30min’
  • New DatetimeIndex class supports both fixed frequency and irregular time series. Replaces now deprecated DateRange class
  • New PeriodIndex and Period classes for representing time spans and performing calendar logic, including the 12 fiscal quarterly frequencies <timeseries.quarterly>. This is a partial port of, and a substantial enhancement to, elements of the scikits.timeseries codebase. Support for conversion between PeriodIndex and DatetimeIndex
  • New Timestamp data type subclasses datetime.datetime, providing the same interface while enabling working with nanosecond-resolution data. Also provides easy time zone conversions.
  • Enhanced support for time zones. Add tz_convert and tz_lcoalize methods to TimeSeries and DataFrame. All timestamps are stored as UTC; Timestamps from DatetimeIndex objects with time zone set will be localized to localtime. Time zone conversions are therefore essentially free. User needs to know very little about pytz library now; only time zone names as as strings are required. Time zone-aware timestamps are equal if and only if their UTC timestamps match. Operations between time zone-aware time series with different time zones will result in a UTC-indexed time series.
  • Time series string indexing conveniences / shortcuts: slice years, year and month, and index values with strings
  • Enhanced time series plotting; adaptation of scikits.timeseries matplotlib-based plotting code
  • New date_range, bdate_range, and period_range factory functions
  • Robust frequency inference function infer_freq and inferred_freq property of DatetimeIndex, with option to infer frequency on construction of DatetimeIndex
  • to_datetime function efficiently parses array of strings to DatetimeIndex. DatetimeIndex will parse array or list of strings to datetime64
  • Optimized support for datetime64-dtype data in Series and DataFrame columns
  • New NaT (Not-a-Time) type to represent NA in timestamp arrays
  • Optimize Series.asof for looking up “as of” values for arrays of timestamps
  • Milli, Micro, Nano date offset objects
  • Can index time series with datetime.time objects to select all data at particular time of day (TimeSeries.at_time) or between two times (TimeSeries.between_time)
  • Add tshift method for leading/lagging using the frequency (if any) of the index, as opposed to a naive lead/lag using shift

Other new features

  • New cut and qcut functions (like R’s cut function) for computing a categorical variable from a continuous variable by binning values either into value-based (cut) or quantile-based (qcut) bins
  • Rename Factor to Categorical and add a number of usability features
  • Add limit argument to fillna/reindex
  • More flexible multiple function application in GroupBy, and can pass list (name, function) tuples to get result in particular order with given names
  • Add flexible replace method for efficiently substituting values
  • Enhanced read_csv/read_table for reading time series data and converting multiple columns to dates
  • Add comments option to parser functions: read_csv, etc.
  • Add :ref`dayfirst <io.dayfirst>` option to parser functions for parsing international DD/MM/YYYY dates
  • Allow the user to specify the CSV reader dialect to control quoting etc.
  • Handling thousands separators in read_csv to improve integer parsing.
  • Enable unstacking of multiple levels in one shot. Alleviate pivot_table bugs (empty columns being introduced)
  • Move to klib-based hash tables for indexing; better performance and less memory usage than Python’s dict
  • Add first, last, min, max, and prod optimized GroupBy functions
  • New ordered_merge function
  • Add flexible comparison instance methods eq, ne, lt, gt, etc. to DataFrame, Series
  • Improve scatter_matrix plotting function and add histogram or kernel density estimates to diagonal
  • Add ‘kde’ plot option for density plots
  • Support for converting DataFrame to R data.frame through rpy2
  • Improved support for complex numbers in Series and DataFrame
  • Add pct_change method to all data structures
  • Add max_colwidth configuration option for DataFrame console output
  • Interpolate Series values using index values
  • Can select multiple columns from GroupBy
  • Add update methods to Series/DataFrame for updating values in place
  • Add any and all method to DataFrame

New plotting methods

Series.plot now supports a secondary_y option:

In [1669]: plt.figure()
Out[1669]: <matplotlib.figure.Figure at 0x1de229d0>

In [1670]: fx['FR'].plot(style='g')
Out[1670]: <matplotlib.axes.AxesSubplot at 0x1de22f50>

In [1671]: fx['IT'].plot(style='k--', secondary_y=True)
Out[1671]: <matplotlib.axes.AxesSubplot at 0x1de22f50>
_images/whatsnew_secondary_y.png

Vytautas Jancauskas, the 2012 GSOC participant, has added many new plot types. For example, 'kde' is a new option:

In [1672]: s = Series(np.concatenate((np.random.randn(1000),
   ......:                            np.random.randn(1000) * 0.5 + 3)))
   ......:

In [1673]: plt.figure()
Out[1673]: <matplotlib.figure.Figure at 0x1de22750>

In [1674]: s.hist(normed=True, alpha=0.2)
Out[1674]: <matplotlib.axes.AxesSubplot at 0x1e7e7ad0>

In [1675]: s.plot(kind='kde')
Out[1675]: <matplotlib.axes.AxesSubplot at 0x1e7e7ad0>
_images/whatsnew_kde.png

See the plotting page for much more.

Other API changes

  • Deprecation of offset, time_rule, and timeRule arguments names in time series functions. Warnings will be printed until pandas 0.9 or 1.0.

Potential porting issues for pandas <= 0.7.3 users

The major change that may affect you in pandas 0.8.0 is that time series indexes use NumPy’s datetime64 data type instead of dtype=object arrays of Python’s built-in datetime.datetime objects. DateRange has been replaced by DatetimeIndex but otherwise behaved identically. But, if you have code that converts DateRange or Index objects that used to contain datetime.datetime values to plain NumPy arrays, you may have bugs lurking with code using scalar values because you are handing control over to NumPy:

In [1676]: import datetime

In [1677]: rng = date_range('1/1/2000', periods=10)

In [1678]: rng[5]
Out[1678]: <Timestamp: 2000-01-06 00:00:00>

In [1679]: isinstance(rng[5], datetime.datetime)
Out[1679]: True

In [1680]: rng_asarray = np.asarray(rng)

In [1681]: scalar_val = rng_asarray[5]

In [1682]: type(scalar_val)
Out[1682]: numpy.datetime64

pandas’s Timestamp object is a subclass of datetime.datetime that has nanosecond support (the nanosecond field store the nanosecond value between 0 and 999). It should substitute directly into any code that used datetime.datetime values before. Thus, I recommend not casting DatetimeIndex to regular NumPy arrays.

If you have code that requires an array of datetime.datetime objects, you have a couple of options. First, the asobject property of DatetimeIndex produces an array of Timestamp objects:

In [1683]: stamp_array = rng.asobject

In [1684]: stamp_array
Out[1684]: Index([2000-01-01, 2000-01-02, 2000-01-03, 2000-01-04, 2000-01-05, 2000-01-06, 2000-01-07, 2000-01-08, 2000-01-09, 2000-01-10], dtype=object)

In [1685]: stamp_array[5]
Out[1685]: <Timestamp: 2000-01-06 00:00:00>

To get an array of proper datetime.datetime objects, use the to_pydatetime method:

In [1686]: dt_array = rng.to_pydatetime()

In [1687]: dt_array
Out[1687]: 
array([2000-01-01 00:00:00, 2000-01-02 00:00:00, 2000-01-03 00:00:00,
       2000-01-04 00:00:00, 2000-01-05 00:00:00, 2000-01-06 00:00:00,
       2000-01-07 00:00:00, 2000-01-08 00:00:00, 2000-01-09 00:00:00,
       2000-01-10 00:00:00], dtype=object)

In [1688]: dt_array[5]
Out[1688]: datetime.datetime(2000, 1, 6, 0, 0)

matplotlib knows how to handle datetime.datetime but not Timestamp objects. While I recommend that you plot time series using TimeSeries.plot, you can either use to_pydatetime or register a converter for the Timestamp type. See matplotlib documentation for more on this.

Warning

There are bugs in the user-facing API with the nanosecond datetime64 unit in NumPy 1.6. In particular, the string version of the array shows garbage values, and conversion to dtype=object is similarly broken.

In [1689]: rng = date_range('1/1/2000', periods=10)

In [1690]: rng
Out[1690]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2000-01-01 00:00:00, ..., 2000-01-10 00:00:00]
Length: 10, Freq: D, Timezone: None

In [1691]: np.asarray(rng)
Out[1691]: 
array([1970-01-11 184:00:00, 1970-01-11 208:00:00, 1970-01-11 232:00:00,
       1970-01-11 00:00:00, 1970-01-11 24:00:00, 1970-01-11 48:00:00,
       1970-01-11 72:00:00, 1970-01-11 96:00:00, 1970-01-11 120:00:00,
       1970-01-11 144:00:00], dtype=datetime64[ns])

In [1692]: converted = np.asarray(rng, dtype=object)

In [1693]: converted[5]
Out[1693]: datetime.datetime(1970, 1, 11, 48, 0)

Trust me: don’t panic. If you are using NumPy 1.6 and restrict your interaction with datetime64 values to pandas’s API you will be just fine. There is nothing wrong with the data-type (a 64-bit integer internally); all of the important data processing happens in pandas and is heavily tested. I strongly recommend that you do not work directly with datetime64 arrays in NumPy 1.6 and only use the pandas API.

Support for non-unique indexes: In the latter case, you may have code inside a try:... catch: block that failed due to the index not being unique. In many cases it will no longer fail (some method like append still check for uniqueness unless disabled). However, all is not lost: you can inspect index.is_unique and raise an exception explicitly if it is False or go to a different code branch.

v.0.7.3 (April 12, 2012)

This is a minor release from 0.7.2 and fixes many minor bugs and adds a number of nice new features. There are also a couple of API changes to note; these should not affect very many users, and we are inclined to call them “bug fixes” even though they do constitute a change in behavior. See the full release notes or issue tracker on GitHub for a complete list.

New features

from pandas.tools.plotting import scatter_matrix
scatter_matrix(df, alpha=0.2)
_images/scatter_matrix_kde.png
  • Add stacked argument to Series and DataFrame’s plot method for stacked bar plots.
df.plot(kind='bar', stacked=True)
_images/bar_plot_stacked_ex.png
df.plot(kind='barh', stacked=True)
_images/barh_plot_stacked_ex.png
  • Add log x and y scaling options to DataFrame.plot and Series.plot
  • Add kurt methods to Series and DataFrame for computing kurtosis

NA Boolean Comparison API Change

Reverted some changes to how NA values (represented typically as NaN or None) are handled in non-numeric Series:

In [1694]: series = Series(['Steve', np.nan, 'Joe'])

In [1695]: series == 'Steve'
Out[1695]: 
0     True
1    False
2    False
dtype: bool

In [1696]: series != 'Steve'
Out[1696]: 
0    False
1     True
2     True
dtype: bool

In comparisons, NA / NaN will always come through as False except with != which is True. Be very careful with boolean arithmetic, especially negation, in the presence of NA data. You may wish to add an explicit NA filter into boolean array operations if you are worried about this:

In [1697]: mask = series == 'Steve'

In [1698]: series[mask & series.notnull()]
Out[1698]: 
0    Steve
dtype: object

While propagating NA in comparisons may seem like the right behavior to some users (and you could argue on purely technical grounds that this is the right thing to do), the evaluation was made that propagating NA everywhere, including in numerical arrays, would cause a large amount of problems for users. Thus, a “practicality beats purity” approach was taken. This issue may be revisited at some point in the future.

Other API Changes

When calling apply on a grouped Series, the return value will also be a Series, to be more consistent with the groupby behavior with DataFrame:

In [1699]: df = DataFrame({'A' : ['foo', 'bar', 'foo', 'bar',
   ......:                     'foo', 'bar', 'foo', 'foo'],
   ......:                 'B' : ['one', 'one', 'two', 'three',
   ......:                        'two', 'two', 'one', 'three'],
   ......:                 'C' : np.random.randn(8), 'D' : np.random.randn(8)})
   ......:

In [1700]: df
Out[1700]: 
     A      B         C         D
0  foo    one  0.255678 -0.295328
1  bar    one  0.055213 -2.208596
2  foo    two -0.190798 -0.097122
3  bar  three  0.247394  0.289633
4  foo    two  0.453403  0.160891
5  bar    two  1.925709 -1.902936
6  foo    one  0.714705 -0.348722
7  foo  three  1.781358  0.352378

In [1701]: grouped = df.groupby('A')['C']

In [1702]: grouped.describe()
Out[1702]: 
A         
bar  count    3.000000
     mean     0.742772
     std      1.028950
     min      0.055213
     25%      0.151304
     50%      0.247394
     75%      1.086551
     max      1.925709
foo  count    5.000000
     mean     0.602869
     std      0.737247
     min     -0.190798
     25%      0.255678
     50%      0.453403
     75%      0.714705
     max      1.781358
dtype: float64

In [1703]: grouped.apply(lambda x: x.order()[-2:]) # top 2 values
Out[1703]: 
A     
bar  3    0.247394
     5    1.925709
foo  6    0.714705
     7    1.781358
dtype: float64

v.0.7.2 (March 16, 2012)

This release targets bugs in 0.7.1, and adds a few minor features.

New features

  • Add additional tie-breaking methods in DataFrame.rank (GH874)
  • Add ascending parameter to rank in Series, DataFrame (GH875)
  • Add coerce_float option to DataFrame.from_records (GH893)
  • Add sort_columns parameter to allow unsorted plots (GH918)
  • Enable column access via attributes on GroupBy (GH882)
  • Can pass dict of values to DataFrame.fillna (GH661)
  • Can select multiple hierarchical groups by passing list of values in .ix (GH134)
  • Add axis option to DataFrame.fillna (GH174)
  • Add level keyword to drop for dropping values from a level (GH159)

Performance improvements

  • Use khash for Series.value_counts, add raw function to algorithms.py (GH861)
  • Intercept __builtin__.sum in groupby (GH885)

v.0.7.1 (February 29, 2012)

This release includes a few new features and addresses over a dozen bugs in 0.7.0.

New features

  • Add to_clipboard function to pandas namespace for writing objects to the system clipboard (GH774)
  • Add itertuples method to DataFrame for iterating through the rows of a dataframe as tuples (GH818)
  • Add ability to pass fill_value and method to DataFrame and Series align method (GH806, GH807)
  • Add fill_value option to reindex, align methods (GH784)
  • Enable concat to produce DataFrame from Series (GH787)
  • Add between method to Series (GH802)
  • Add HTML representation hook to DataFrame for the IPython HTML notebook (GH773)
  • Support for reading Excel 2007 XML documents using openpyxl

Performance improvements

  • Improve performance and memory usage of fillna on DataFrame
  • Can concatenate a list of Series along axis=1 to obtain a DataFrame (GH787)

v.0.7.0 (February 9, 2012)

New features

  • New unified merge function for efficiently performing full gamut of database / relational-algebra operations. Refactored existing join methods to use the new infrastructure, resulting in substantial performance gains (GH220, GH249, GH267)
  • New unified concatenation function for concatenating Series, DataFrame or Panel objects along an axis. Can form union or intersection of the other axes. Improves performance of Series.append and DataFrame.append (GH468, GH479, GH273)
  • Can pass multiple DataFrames to DataFrame.append to concatenate (stack) and multiple Series to Series.append too
  • Can pass list of dicts (e.g., a list of JSON objects) to DataFrame constructor (GH526)
  • You can now set multiple columns in a DataFrame via __getitem__, useful for transformation (GH342)
  • Handle differently-indexed output values in DataFrame.apply (GH498)
In [1704]: df = DataFrame(randn(10, 4))

In [1705]: df.apply(lambda x: x.describe())
Out[1705]: 
               0          1          2          3
count  10.000000  10.000000  10.000000  10.000000
mean    0.467956  -0.271208   0.320479   0.255854
std     1.371729   0.759631   0.962485   0.661379
min    -2.055090  -1.349964  -0.905821  -0.904464
25%    -0.357215  -0.622232  -0.529872  -0.186021
50%     0.576651  -0.298812   0.317472   0.345715
75%     1.710590  -0.184047   1.031023   0.830109
max     2.061568   1.147814   1.641604   1.034401
  • Add reorder_levels method to Series and DataFrame (PR534)
  • Add dict-like get function to DataFrame and Panel (PR521)
  • Add DataFrame.iterrows method for efficiently iterating through the rows of a DataFrame
  • Add DataFrame.to_panel with code adapted from LongPanel.to_long
  • Add reindex_axis method added to DataFrame
  • Add level option to binary arithmetic functions on DataFrame and Series
  • Add level option to the reindex and align methods on Series and DataFrame for broadcasting values across a level (GH542, PR552, others)
  • Add attribute-based item access to Panel and add IPython completion (PR563)
  • Add logy option to Series.plot for log-scaling on the Y axis
  • Add index and header options to DataFrame.to_string
  • Can pass multiple DataFrames to DataFrame.join to join on index (GH115)
  • Can pass multiple Panels to Panel.join (GH115)
  • Added justify argument to DataFrame.to_string to allow different alignment of column headers
  • Add sort option to GroupBy to allow disabling sorting of the group keys for potential speedups (GH595)
  • Can pass MaskedArray to Series constructor (PR563)
  • Add Panel item access via attributes and IPython completion (GH554)
  • Implement DataFrame.lookup, fancy-indexing analogue for retrieving values given a sequence of row and column labels (GH338)
  • Can pass a list of functions to aggregate with groupby on a DataFrame, yielding an aggregated result with hierarchical columns (GH166)
  • Can call cummin and cummax on Series and DataFrame to get cumulative minimum and maximum, respectively (GH647)
  • value_range added as utility function to get min and max of a dataframe (GH288)
  • Added encoding argument to read_csv, read_table, to_csv and from_csv for non-ascii text (GH717)
  • Added abs method to pandas objects
  • Added crosstab function for easily computing frequency tables
  • Added isin method to index objects
  • Added level argument to xs method of DataFrame.

API Changes to integer indexing

One of the potentially riskiest API changes in 0.7.0, but also one of the most important, was a complete review of how integer indexes are handled with regard to label-based indexing. Here is an example:

In [1706]: s = Series(randn(10), index=range(0, 20, 2))

In [1707]: s
Out[1707]: 
0     0.910822
2     0.695714
4    -0.955386
6     0.359339
8    -0.189177
10   -1.168504
12   -1.381056
14    0.786651
16    0.288704
18    0.148544
dtype: float64

In [1708]: s[0]
Out[1708]: 0.910822002253868

In [1709]: s[2]
Out[1709]: 0.69571446395605785

In [1710]: s[4]
Out[1710]: -0.95538648457113173

This is all exactly identical to the behavior before. However, if you ask for a key not contained in the Series, in versions 0.6.1 and prior, Series would fall back on a location-based lookup. This now raises a KeyError:

In [2]: s[1]
KeyError: 1

This change also has the same impact on DataFrame:

In [3]: df = DataFrame(randn(8, 4), index=range(0, 16, 2))

In [4]: df
    0        1       2       3
0   0.88427  0.3363 -0.1787  0.03162
2   0.14451 -0.1415  0.2504  0.58374
4  -1.44779 -0.9186 -1.4996  0.27163
6  -0.26598 -2.4184 -0.2658  0.11503
8  -0.58776  0.3144 -0.8566  0.61941
10  0.10940 -0.7175 -1.0108  0.47990
12 -1.16919 -0.3087 -0.6049 -0.43544
14 -0.07337  0.3410  0.0424 -0.16037

In [5]: df.ix[3]
KeyError: 3

In order to support purely integer-based indexing, the following methods have been added:

Method Description
Series.iget_value(i) Retrieve value stored at location i
Series.iget(i) Alias for iget_value
DataFrame.irow(i) Retrieve the i-th row
DataFrame.icol(j) Retrieve the j-th column
DataFrame.iget_value(i, j) Retrieve the value at row i and column j

API tweaks regarding label-based slicing

Label-based slicing using ix now requires that the index be sorted (monotonic) unless both the start and endpoint are contained in the index:

In [1711]: s = Series(randn(6), index=list('gmkaec'))

In [1712]: s
Out[1712]: 
g    0.842702
m   -1.876494
k   -0.365497
a   -2.231289
e    0.716546
c   -0.069151
dtype: float64

Then this is OK:

In [1713]: s.ix['k':'e']
Out[1713]: 
k   -0.365497
a   -2.231289
e    0.716546
dtype: float64

But this is not:

In [12]: s.ix['b':'h']
KeyError 'b'

If the index had been sorted, the “range selection” would have been possible:

In [1714]: s2 = s.sort_index()

In [1715]: s2
Out[1715]: 
a   -2.231289
c   -0.069151
e    0.716546
g    0.842702
k   -0.365497
m   -1.876494
dtype: float64

In [1716]: s2.ix['b':'h']
Out[1716]: 
c   -0.069151
e    0.716546
g    0.842702
dtype: float64

Changes to Series [] operator

As as notational convenience, you can pass a sequence of labels or a label slice to a Series when getting and setting values via [] (i.e. the __getitem__ and __setitem__ methods). The behavior will be the same as passing similar input to ix except in the case of integer indexing:

In [1717]: s = Series(randn(6), index=list('acegkm'))

In [1718]: s
Out[1718]: 
a   -0.651033
c   -1.163455
e    1.627107
g    2.008883
k   -0.431064
m   -1.687776
dtype: float64

In [1719]: s[['m', 'a', 'c', 'e']]
Out[1719]: 
m   -1.687776
a   -0.651033
c   -1.163455
e    1.627107
dtype: float64

In [1720]: s['b':'l']
Out[1720]: 
c   -1.163455
e    1.627107
g    2.008883
k   -0.431064
dtype: float64

In [1721]: s['c':'k']
Out[1721]: 
c   -1.163455
e    1.627107
g    2.008883
k   -0.431064
dtype: float64

In the case of integer indexes, the behavior will be exactly as before (shadowing ndarray):

In [1722]: s = Series(randn(6), index=range(0, 12, 2))

In [1723]: s[[4, 0, 2]]
Out[1723]: 
4   -0.593879
0   -0.271860
2    1.101084
dtype: float64

In [1724]: s[1:5]
Out[1724]: 
2    1.101084
4   -0.593879
6    0.873445
8    2.880726
dtype: float64

If you wish to do indexing with sequences and slicing on an integer index with label semantics, use ix.

Other API Changes

  • The deprecated LongPanel class has been completely removed
  • If Series.sort is called on a column of a DataFrame, an exception will now be raised. Before it was possible to accidentally mutate a DataFrame’s column by doing df[col].sort() instead of the side-effect free method df[col].order() (GH316)
  • Miscellaneous renames and deprecations which will (harmlessly) raise FutureWarning
  • drop added as an optional parameter to DataFrame.reset_index (GH699)

Performance improvements

  • Cythonized GroupBy aggregations no longer presort the data, thus achieving a significant speedup (GH93). GroupBy aggregations with Python functions significantly sped up by clever manipulation of the ndarray data type in Cython (GH496).
  • Better error message in DataFrame constructor when passed column labels don’t match data (GH497)
  • Substantially improve performance of multi-GroupBy aggregation when a Python function is passed, reuse ndarray object in Cython (GH496)
  • Can store objects indexed by tuples and floats in HDFStore (GH492)
  • Don’t print length by default in Series.to_string, add length option (GH489)
  • Improve Cython code for multi-groupby to aggregate without having to sort the data (GH93)
  • Improve MultiIndex reindexing speed by storing tuples in the MultiIndex, test for backwards unpickling compatibility
  • Improve column reindexing performance by using specialized Cython take function
  • Further performance tweaking of Series.__getitem__ for standard use cases
  • Avoid Index dict creation in some cases (i.e. when getting slices, etc.), regression from prior versions
  • Friendlier error message in setup.py if NumPy not installed
  • Use common set of NA-handling operations (sum, mean, etc.) in Panel class also (GH536)
  • Default name assignment when calling reset_index on DataFrame with a regular (non-hierarchical) index (GH476)
  • Use Cythonized groupers when possible in Series/DataFrame stat ops with level parameter passed (GH545)
  • Ported skiplist data structure to C to speed up rolling_median by about 5-10x in most typical use cases (GH374)

v.0.6.1 (December 13, 2011)

New features

Performance improvements

  • Improve memory usage of DataFrame.describe (do not copy data unnecessarily) (PR #425)
  • Optimize scalar value lookups in the general case by 25% or more in Series and DataFrame
  • Fix performance regression in cross-sectional count in DataFrame, affecting DataFrame.dropna speed
  • Column deletion in DataFrame copies no data (computes views on blocks) (GH #158)

v.0.6.0 (November 25, 2011)

New Features

  • Added melt function to pandas.core.reshape
  • Added level parameter to group by level in Series and DataFrame descriptive statistics (PR313)
  • Added head and tail methods to Series, analogous to to DataFrame (PR296)
  • Added Series.isin function which checks if each value is contained in a passed sequence (GH289)
  • Added float_format option to Series.to_string
  • Added skip_footer (GH291) and converters (GH343) options to read_csv and read_table
  • Added drop_duplicates and duplicated functions for removing duplicate DataFrame rows and checking for duplicate rows, respectively (GH319)
  • Implemented operators ‘&’, ‘|’, ‘^’, ‘-‘ on DataFrame (GH347)
  • Added Series.mad, mean absolute deviation
  • Added QuarterEnd DateOffset (PR321)
  • Added dot to DataFrame (GH65)
  • Added orient option to Panel.from_dict (GH359, GH301)
  • Added orient option to DataFrame.from_dict
  • Added passing list of tuples or list of lists to DataFrame.from_records (GH357)
  • Added multiple levels to groupby (GH103)
  • Allow multiple columns in by argument of DataFrame.sort_index (GH92, PR362)
  • Added fast get_value and put_value methods to DataFrame (GH360)
  • Added cov instance methods to Series and DataFrame (GH194, PR362)
  • Added kind='bar' option to DataFrame.plot (PR348)
  • Added idxmin and idxmax to Series and DataFrame (PR286)
  • Added read_clipboard function to parse DataFrame from clipboard (GH300)
  • Added nunique function to Series for counting unique elements (GH297)
  • Made DataFrame constructor use Series name if no columns passed (GH373)
  • Support regular expressions in read_table/read_csv (GH364)
  • Added DataFrame.to_html for writing DataFrame to HTML (PR387)
  • Added support for MaskedArray data in DataFrame, masked values converted to NaN (PR396)
  • Added DataFrame.boxplot function (GH368)
  • Can pass extra args, kwds to DataFrame.apply (GH376)
  • Implement DataFrame.join with vector on argument (GH312)
  • Added legend boolean flag to DataFrame.plot (GH324)
  • Can pass multiple levels to stack and unstack (GH370)
  • Can pass multiple values columns to pivot_table (GH381)
  • Use Series name in GroupBy for result index (GH363)
  • Added raw option to DataFrame.apply for performance if only need ndarray (GH309)
  • Added proper, tested weighted least squares to standard and panel OLS (GH303)

Performance Enhancements

  • VBENCH Cythonized cache_readonly, resulting in substantial micro-performance enhancements throughout the codebase (GH361)
  • VBENCH Special Cython matrix iterator for applying arbitrary reduction operations with 3-5x better performance than np.apply_along_axis (GH309)
  • VBENCH Improved performance of MultiIndex.from_tuples
  • VBENCH Special Cython matrix iterator for applying arbitrary reduction operations
  • VBENCH + DOCUMENT Add raw option to DataFrame.apply for getting better performance when
  • VBENCH Faster cythonized count by level in Series and DataFrame (GH341)
  • VBENCH? Significant GroupBy performance enhancement with multiple keys with many “empty” combinations
  • VBENCH New Cython vectorized function map_infer speeds up Series.apply and Series.map significantly when passed elementwise Python function, motivated by (PR355)
  • VBENCH Significantly improved performance of Series.order, which also makes np.unique called on a Series faster (GH327)
  • VBENCH Vastly improved performance of GroupBy on axes with a MultiIndex (GH299)

v.0.5.0 (October 24, 2011)

New Features

  • Added DataFrame.align method with standard join options
  • Added parse_dates option to read_csv and read_table methods to optionally try to parse dates in the index columns
  • Added nrows, chunksize, and iterator arguments to read_csv and read_table. The last two return a new TextParser class capable of lazily iterating through chunks of a flat file (GH242)
  • Added ability to join on multiple columns in DataFrame.join (GH214)
  • Added private _get_duplicates function to Index for identifying duplicate values more easily (ENH5c)
  • Added column attribute access to DataFrame.
  • Added Python tab completion hook for DataFrame columns. (PR233, GH230)
  • Implemented Series.describe for Series containing objects (PR241)
  • Added inner join option to DataFrame.join when joining on key(s) (GH248)
  • Implemented selecting DataFrame columns by passing a list to __getitem__ (GH253)
  • Implemented & and | to intersect / union Index objects, respectively (GH261)
  • Added pivot_table convenience function to pandas namespace (GH234)
  • Implemented Panel.rename_axis function (GH243)
  • DataFrame will show index level names in console output (PR334)
  • Implemented Panel.take
  • Added set_eng_float_format for alternate DataFrame floating point string formatting (ENH61)
  • Added convenience set_index function for creating a DataFrame index from its existing columns
  • Implemented groupby hierarchical index level name (GH223)
  • Added support for different delimiters in DataFrame.to_csv (PR244)
  • TODO: DOCS ABOUT TAKE METHODS

Performance Enhancements

  • VBENCH Major performance improvements in file parsing functions read_csv and read_table
  • VBENCH Added Cython function for converting tuples to ndarray very fast. Speeds up many MultiIndex-related operations
  • VBENCH Refactored merging / joining code into a tidy class and disabled unnecessary computations in the float/object case, thus getting about 10% better performance (GH211)
  • VBENCH Improved speed of DataFrame.xs on mixed-type DataFrame objects by about 5x, regression from 0.3.0 (GH215)
  • VBENCH With new DataFrame.align method, speeding up binary operations between differently-indexed DataFrame objects by 10-25%.
  • VBENCH Significantly sped up conversion of nested dict into DataFrame (GH212)
  • VBENCH Significantly speed up DataFrame __repr__ and count on large mixed-type DataFrame objects

v.0.4.3 through v0.4.1 (September 25 - October 9, 2011)

New Features

  • Added Python 3 support using 2to3 (PR200)
  • Added name attribute to Series, now prints as part of Series.__repr__
  • Added instance methods isnull and notnull to Series (PR209, GH203)
  • Added Series.align method for aligning two series with choice of join method (ENH56)
  • Added method get_level_values to MultiIndex (IS188)
  • Set values in mixed-type DataFrame objects via .ix indexing attribute (GH135)
  • Added new DataFrame methods get_dtype_counts and property dtypes (ENHdc)
  • Added ignore_index option to DataFrame.append to stack DataFrames (ENH1b)
  • read_csv tries to sniff delimiters using csv.Sniffer (PR146)
  • read_csv can read multiple columns into a MultiIndex; DataFrame’s to_csv method writes out a corresponding MultiIndex (PR151)
  • DataFrame.rename has a new copy parameter to rename a DataFrame in place (ENHed)
  • Enable unstacking by name (PR142)
  • Enable sortlevel to work by level (PR141)

Performance Enhancements

  • Altered binary operations on differently-indexed SparseSeries objects to use the integer-based (dense) alignment logic which is faster with a larger number of blocks (GH205)
  • Wrote faster Cython data alignment / merging routines resulting in substantial speed increases
  • Improved performance of isnull and notnull, a regression from v0.3.0 (GH187)
  • Refactored code related to DataFrame.join so that intermediate aligned copies of the data in each DataFrame argument do not need to be created. Substantial performance increases result (GH176)
  • Substantially improved performance of generic Index.intersection and Index.union
  • Implemented BlockManager.take resulting in significantly faster take performance on mixed-type DataFrame objects (GH104)
  • Improved performance of Series.sort_index
  • Significant groupby performance enhancement: removed unnecessary integrity checks in DataFrame internals that were slowing down slicing operations to retrieve groups
  • Optimized _ensure_index function resulting in performance savings in type-checking Index objects
  • Wrote fast time series merging / joining methods in Cython. Will be integrated later into DataFrame.join and related functions