.. _whatsnew_0100:

.. ipython:: python
   :suppress:

   from pandas.compat import StringIO

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:

.. ipython:: python
   :okwarning:

   import pandas as pd
   df = pd.DataFrame(np.random.randn(6, 4),
                     index=pd.date_range('1/1/2000', periods=6))
   df
   # deprecated now
   df - df[0]
   # Change your code to
   df.sub(df[0], axis=0) # align on axis 0 (rows)

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:

.. ipython:: python

    dates = pd.date_range('1/1/2000', '1/5/2000', freq='4h')
    series = Series(np.arange(len(dates)), index=dates)
    series
    series.resample('D', how='sum')
    # old behavior
    series.resample('D', how='sum', closed='right', label='right')

- 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:

.. ipython:: python

    s = pd.Series([1.5, np.inf, 3.4, -np.inf])
	pd.isnull(s)
    s.fillna(0)
    pd.set_option('use_inf_as_null', True)
	pd.isnull(s)
    s.fillna(0)
	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'``:

.. ipython:: python

    data= 'a,b,c\n1,Yes,2\n3,No,4'
    print(data)
    pd.read_csv(StringIO(data), header=None)
    pd.read_csv(StringIO(data), header=None, prefix='X')

- 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:

.. ipython:: python

    print(data)
    pd.read_csv(StringIO(data))
    pd.read_csv(StringIO(data), true_values=['Yes'], false_values=['No'])

- 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:

.. ipython:: python

   s = Series([np.nan, 1., 2., np.nan, 4])
   s
   s.fillna(0)
   s.fillna(method='pad')

Convenience methods ``ffill`` and  ``bfill`` have been added:

.. ipython:: python

   s.ffill()


- ``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

  .. ipython:: python

      def f(x):
          return Series([ x, x**2 ], index = ['x', 'x^2'])

      s = Series(np.random.rand(5))
      s
      s.apply(f)

- New API functions for working with pandas options (:issue:`2097`):

  - ``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:

  .. ipython:: python

     get_option("display.max_rows")

- to_string() methods now always return unicode strings  (:issue:`2224`).

New features
~~~~~~~~~~~~

Wide DataFrame Printing
~~~~~~~~~~~~~~~~~~~~~~~

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

.. ipython:: python

   wide_frame = DataFrame(randn(5, 16))

   wide_frame

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

.. ipython:: python

   pd.set_option('expand_frame_repr', False)

   wide_frame

.. ipython:: python
   :suppress:

   pd.reset_option('expand_frame_repr')

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

.. ipython:: python

   pd.set_option('line_width', 40)

   wide_frame

.. ipython:: python
   :suppress:

   pd.reset_option('line_width')


Updated PyTables Support
~~~~~~~~~~~~~~~~~~~~~~~~

:ref:`Docs <io.hdf5>` for PyTables ``Table`` format & several enhancements to the api. Here is a taste of what to expect.

.. ipython:: python
   :suppress:
   :okexcept:

   os.remove('store.h5')

.. ipython:: python

   store = HDFStore('store.h5')
   df = DataFrame(randn(8, 3), index=date_range('1/1/2000', periods=8),
              columns=['A', 'B', 'C'])
   df

   # appending data frames
   df1 = df[0:4]
   df2 = df[4:]
   store.append('df', df1)
   store.append('df', df2)
   store

   # selecting the entire store
   store.select('df')

.. ipython:: python

   wp = Panel(randn(2, 5, 4), items=['Item1', 'Item2'],
          major_axis=date_range('1/1/2000', periods=5),
          minor_axis=['A', 'B', 'C', 'D'])
   wp

   # storing a panel
   store.append('wp',wp)

   # selecting via A QUERY
   store.select('wp',
     [ Term('major_axis>20000102'), Term('minor_axis', '=', ['A','B']) ])

   # removing data from tables
   store.remove('wp', Term('major_axis>20000103'))
   store.select('wp')

   # deleting a store
   del store['df']
   store

**Enhancements**

- added ability to hierarchical keys

   .. ipython:: python

     store.put('foo/bar/bah', df)
     store.append('food/orange', df)
     store.append('food/apple',  df)
     store

     # remove all nodes under this level
     store.remove('food')
     store

- added mixed-dtype support!

   .. ipython:: python

      df['string'] = 'string'
      df['int']    = 1
      store.append('df',df)
      df1 = store.select('df')
      df1
      df1.get_dtype_counts()

- performance improvments on table writing
- support for arbitrarily indexed dimensions
- ``SparseSeries`` now has a ``density`` property (:issue:`2384`)
- enable ``Series.str.strip/lstrip/rstrip`` methods to take an input argument
  to strip arbitrary characters (:issue:`2411`)
- implement ``value_vars`` in ``melt`` to limit values to certain columns
  and add ``melt`` to pandas namespace (:issue:`2412`)

**Bug Fixes**

- added ``Term`` method of specifying where conditions (:issue:`1996`).
- ``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)
  (:issue:`698`).
- 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)

.. ipython:: python
   :suppress:

   store.close()
   import os
   os.remove('store.h5')

**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.
:ref:`Docs <dsintro.panel4d>` for NDim. Here is a taste of what to expect.

     .. ipython:: python

        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'])
        p4d





See the :ref:`full release notes
<release>` or issue tracker
on GitHub for a complete list.

