diff --git a/doc/source/whatsnew/v0.10.0.rst b/doc/source/whatsnew/v0.10.0.rst index 9e45efca02eed..bc2a4918bc27b 100644 --- a/doc/source/whatsnew/v0.10.0.rst +++ b/doc/source/whatsnew/v0.10.0.rst @@ -5,11 +5,6 @@ v0.10.0 (December 17, 2012) {{ header }} -.. ipython:: python - :suppress: - - from pandas import * # noqa F401, F403 - 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 @@ -60,7 +55,7 @@ talking about: # deprecated now df - df[0] # Change your code to - df.sub(df[0], axis=0) # align on axis 0 (rows) + 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. @@ -77,7 +72,7 @@ labeled the aggregated group with the end of the interval: the next day). In [1]: dates = pd.date_range('1/1/2000', '1/5/2000', freq='4h') - In [2]: series = Series(np.arange(len(dates)), index=dates) + In [2]: series = pd.Series(np.arange(len(dates)), index=dates) In [3]: series Out[3]: @@ -187,10 +182,14 @@ labeled the aggregated group with the end of the interval: the next day). .. ipython:: python - data= 'a,b,c\n1,Yes,2\n3,No,4' + import io + + data = ('a,b,c\n' + '1,Yes,2\n' + '3,No,4') print(data) - pd.read_csv(StringIO(data), header=None) - pd.read_csv(StringIO(data), header=None, prefix='X') + pd.read_csv(io.StringIO(data), header=None) + pd.read_csv(io.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`` @@ -199,8 +198,8 @@ labeled the aggregated group with the end of the interval: the next day). .. ipython:: python print(data) - pd.read_csv(StringIO(data)) - pd.read_csv(StringIO(data), true_values=['Yes'], false_values=['No']) + pd.read_csv(io.StringIO(data)) + pd.read_csv(io.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 @@ -211,7 +210,7 @@ labeled the aggregated group with the end of the interval: the next day). .. ipython:: python - s = Series([np.nan, 1., 2., np.nan, 4]) + s = pd.Series([np.nan, 1., 2., np.nan, 4]) s s.fillna(0) s.fillna(method='pad') @@ -230,9 +229,9 @@ Convenience methods ``ffill`` and ``bfill`` have been added: .. ipython:: python def f(x): - return Series([ x, x**2 ], index = ['x', 'x^2']) + return pd.Series([x, x**2], index=['x', 'x^2']) - s = Series(np.random.rand(5)) + s = pd.Series(np.random.rand(5)) s s.apply(f) @@ -249,7 +248,7 @@ Convenience methods ``ffill`` and ``bfill`` have been added: .. ipython:: python - get_option("display.max_rows") + pd.get_option("display.max_rows") - to_string() methods now always return unicode strings (:issue:`2224`). @@ -264,7 +263,7 @@ representation across multiple rows by default: .. ipython:: python - wide_frame = DataFrame(randn(5, 16)) + wide_frame = pd.DataFrame(np.random.randn(5, 16)) wide_frame @@ -300,13 +299,16 @@ Updated PyTables Support :suppress: :okexcept: + import os + 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']) + store = pd.HDFStore('store.h5') + df = pd.DataFrame(np.random.randn(8, 3), + index=pd.date_range('1/1/2000', periods=8), + columns=['A', 'B', 'C']) df # appending data frames @@ -322,13 +324,13 @@ Updated PyTables Support .. ipython:: python :okwarning: - 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 = pd.Panel(np.random.randn(2, 5, 4), items=['Item1', 'Item2'], + major_axis=pd.date_range('1/1/2000', periods=5), + minor_axis=['A', 'B', 'C', 'D']) wp # storing a panel - store.append('wp',wp) + store.append('wp', wp) # selecting via A QUERY store.select('wp', "major_axis>20000102 and minor_axis=['A','B']") @@ -361,8 +363,8 @@ Updated PyTables Support .. ipython:: python df['string'] = 'string' - df['int'] = 1 - store.append('df',df) + df['int'] = 1 + store.append('df', df) df1 = store.select('df') df1 df1.get_dtype_counts() diff --git a/doc/source/whatsnew/v0.10.1.rst b/doc/source/whatsnew/v0.10.1.rst index 98d8214b08943..b5b2b889732cd 100644 --- a/doc/source/whatsnew/v0.10.1.rst +++ b/doc/source/whatsnew/v0.10.1.rst @@ -5,11 +5,6 @@ v0.10.1 (January 22, 2013) {{ header }} -.. ipython:: python - :suppress: - - from pandas import * # noqa F401, F403 - 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 @@ -48,6 +43,8 @@ You may need to upgrade your existing data files. Please visit the :suppress: :okexcept: + import os + os.remove('store.h5') You can designate (and index) certain columns that you want to be able to @@ -55,9 +52,10 @@ perform queries on a table, by passing a list to ``data_columns`` .. ipython:: python - store = HDFStore('store.h5') - df = DataFrame(randn(8, 3), index=date_range('1/1/2000', periods=8), - columns=['A', 'B', 'C']) + store = pd.HDFStore('store.h5') + df = pd.DataFrame(np.random.randn(8, 3), + index=pd.date_range('1/1/2000', periods=8), + columns=['A', 'B', 'C']) df['string'] = 'foo' df.loc[df.index[4:6], 'string'] = np.nan df.loc[df.index[7:9], 'string'] = 'bar' @@ -65,7 +63,7 @@ perform queries on a table, by passing a list to ``data_columns`` df # on-disk operations - store.append('df', df, data_columns = ['B','C','string','string2']) + store.append('df', df, data_columns=['B', 'C', 'string', 'string2']) store.select('df', "B>0 and string=='foo'") # this is in-memory version of this type of selection @@ -77,16 +75,16 @@ Retrieving unique values in an indexable or data column. # note that this is deprecated as of 0.14.0 # can be replicated by: store.select_column('df','index').unique() - store.unique('df','index') - store.unique('df','string') + store.unique('df', 'index') + store.unique('df', 'string') You can now store ``datetime64`` in data columns .. ipython:: python - df_mixed = df.copy() - df_mixed['datetime64'] = Timestamp('20010102') - df_mixed.loc[df_mixed.index[3:4], ['A','B']] = np.nan + df_mixed = df.copy() + df_mixed['datetime64'] = pd.Timestamp('20010102') + df_mixed.loc[df_mixed.index[3:4], ['A', 'B']] = np.nan store.append('df_mixed', df_mixed) df_mixed1 = store.select('df_mixed') @@ -99,21 +97,21 @@ columns, this is equivalent to passing a .. ipython:: python - store.select('df',columns = ['A','B']) + store.select('df', columns=['A', 'B']) ``HDFStore`` now serializes MultiIndex dataframes when appending tables. .. code-block:: ipython - In [19]: 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 [19]: index = pd.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 [20]: df = DataFrame(np.random.randn(10, 3), index=index, - ....: columns=['A', 'B', 'C']) + In [20]: df = pd.DataFrame(np.random.randn(10, 3), index=index, + ....: columns=['A', 'B', 'C']) ....: In [21]: df @@ -131,7 +129,7 @@ columns, this is equivalent to passing a two -3.207595 -1.535854 0.409769 three -0.673145 -0.741113 -0.110891 - In [22]: store.append('mi',df) + In [22]: store.append('mi', df) In [23]: store.select('mi') Out[23]: @@ -162,12 +160,14 @@ combined result, by using ``where`` on a selector table. .. ipython:: python - df_mt = DataFrame(randn(8, 6), index=date_range('1/1/2000', periods=8), - columns=['A', 'B', 'C', 'D', 'E', 'F']) + df_mt = pd.DataFrame(np.random.randn(8, 6), + index=pd.date_range('1/1/2000', periods=8), + columns=['A', 'B', 'C', 'D', 'E', 'F']) df_mt['foo'] = 'bar' # you can also create the tables individually - store.append_to_multiple({ 'df1_mt' : ['A','B'], 'df2_mt' : None }, df_mt, selector = 'df1_mt') + store.append_to_multiple({'df1_mt': ['A', 'B'], 'df2_mt': None}, + df_mt, selector='df1_mt') store # indiviual tables were created @@ -175,13 +175,13 @@ combined result, by using ``where`` on a selector table. store.select('df2_mt') # as a multiple - store.select_as_multiple(['df1_mt','df2_mt'], where = [ 'A>0','B>0' ], selector = 'df1_mt') + store.select_as_multiple(['df1_mt', 'df2_mt'], where=['A>0', 'B>0'], + selector='df1_mt') .. ipython:: python :suppress: store.close() - import os os.remove('store.h5') **Enhancements** diff --git a/doc/source/whatsnew/v0.11.0.rst b/doc/source/whatsnew/v0.11.0.rst index 971caddcbd47f..baa464fe842d3 100644 --- a/doc/source/whatsnew/v0.11.0.rst +++ b/doc/source/whatsnew/v0.11.0.rst @@ -5,11 +5,6 @@ v0.11.0 (April 22, 2013) {{ header }} -.. ipython:: python - :suppress: - - from pandas import * # noqa F401, F403 - This is a major release from 0.10.1 and includes many new features and enhancements along with a large number of bug fixes. The methods of Selecting @@ -79,12 +74,12 @@ Numeric dtypes will propagate and can coexist in DataFrames. If a dtype is passe .. ipython:: python - df1 = DataFrame(randn(8, 1), columns = ['A'], dtype = 'float32') + df1 = pd.DataFrame(np.random.randn(8, 1), columns=['A'], dtype='float32') df1 df1.dtypes - df2 = DataFrame(dict( A = Series(randn(8),dtype='float16'), - B = Series(randn(8)), - C = Series(range(8),dtype='uint8') )) + df2 = pd.DataFrame({'A': pd.Series(np.random.randn(8), dtype='float16'), + 'B': pd.Series(np.random.randn(8)), + 'C': pd.Series(range(8), dtype='uint8')}) df2 df2.dtypes @@ -127,9 +122,9 @@ Forcing Date coercion (and setting ``NaT`` when not datelike) .. ipython:: python :okwarning: - from datetime import datetime - s = Series([datetime(2001,1,1,0,0), 'foo', 1.0, 1, - Timestamp('20010104'), '20010105'],dtype='O') + import datetime + s = pd.Series([datetime.datetime(2001, 1, 1, 0, 0), 'foo', 1.0, 1, + pd.Timestamp('20010104'), '20010105'], dtype='O') s.convert_objects(convert_dates='coerce') Dtype Gotchas @@ -145,9 +140,9 @@ The following will all result in ``int64`` dtypes .. ipython:: python - DataFrame([1,2],columns=['a']).dtypes - DataFrame({'a' : [1,2] }).dtypes - DataFrame({'a' : 1 }, index=range(2)).dtypes + pd.DataFrame([1, 2], columns=['a']).dtypes + pd.DataFrame({'a': [1, 2]}).dtypes + pd.DataFrame({'a': 1}, index=range(2)).dtypes Keep in mind that ``DataFrame(np.array([1,2]))`` **WILL** result in ``int32`` on 32-bit platforms! @@ -164,7 +159,7 @@ The dtype of the input data will be preserved in cases where ``nans`` are not in dfi dfi.dtypes - casted = dfi[dfi>0] + casted = dfi[dfi > 0] casted casted.dtypes @@ -176,7 +171,7 @@ While float dtypes are unchanged. df4['A'] = df4['A'].astype('float32') df4.dtypes - casted = df4[df4>0] + casted = df4[df4 > 0] casted casted.dtypes @@ -190,23 +185,23 @@ Furthermore ``datetime64[ns]`` columns are created by default, when passed datet .. ipython:: python - df = DataFrame(randn(6,2),date_range('20010102',periods=6),columns=['A','B']) - df['timestamp'] = Timestamp('20010103') + df = pd.DataFrame(np.random.randn(6, 2), pd.date_range('20010102', periods=6), + columns=['A', ' B']) + df['timestamp'] = pd.Timestamp('20010103') df # datetime64[ns] out of the box df.get_dtype_counts() # use the traditional nan, which is mapped to NaT internally - df.loc[df.index[2:4], ['A','timestamp']] = np.nan + df.loc[df.index[2:4], ['A', 'timestamp']] = np.nan df Astype conversion on ``datetime64[ns]`` to ``object``, implicitly converts ``NaT`` to ``np.nan`` .. ipython:: python - import datetime - s = Series([datetime.datetime(2001, 1, 2, 0, 0) for i in range(3)]) + s = pd.Series([datetime.datetime(2001, 1, 2, 0, 0) for i in range(3)]) s.dtype s[1] = np.nan s @@ -250,14 +245,16 @@ Enhancements .. ipython:: python - df = DataFrame(dict(A=lrange(5), B=lrange(5))) - df.to_hdf('store.h5','table',append=True) - read_hdf('store.h5', 'table', where = ['index>2']) + df = pd.DataFrame({'A': lrange(5), 'B': lrange(5)}) + df.to_hdf('store.h5', 'table', append=True) + pd.read_hdf('store.h5', 'table', where=['index > 2']) .. ipython:: python :suppress: :okexcept: + import os + os.remove('store.h5') - provide dotted attribute access to ``get`` from stores, e.g. ``store.df == store['df']`` @@ -271,23 +268,23 @@ Enhancements .. ipython:: python - idx = date_range("2001-10-1", periods=5, freq='M') - ts = Series(np.random.rand(len(idx)),index=idx) + idx = pd.date_range("2001-10-1", periods=5, freq='M') + ts = pd.Series(np.random.rand(len(idx)), index=idx) ts['2001'] - df = DataFrame(dict(A = ts)) + df = pd.DataFrame({'A': ts}) df['2001'] - ``Squeeze`` to possibly remove length 1 dimensions from an object. .. ipython:: python - p = Panel(randn(3,4,4),items=['ItemA','ItemB','ItemC'], - major_axis=date_range('20010102',periods=4), - minor_axis=['A','B','C','D']) + p = pd.Panel(np.random.randn(3, 4, 4), items=['ItemA', 'ItemB', 'ItemC'], + major_axis=pd.date_range('20010102', periods=4), + minor_axis=['A', 'B', 'C', 'D']) p p.reindex(items=['ItemA']).squeeze() - p.reindex(items=['ItemA'],minor=['B']).squeeze() + p.reindex(items=['ItemA'], minor=['B']).squeeze() - In ``pd.io.data.Options``, diff --git a/setup.cfg b/setup.cfg index ff67d1cfdf286..1a65601f4578e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -50,9 +50,6 @@ exclude = doc/source/whatsnew/v0.8.0.rst doc/source/whatsnew/v0.9.0.rst doc/source/whatsnew/v0.9.1.rst - doc/source/whatsnew/v0.10.0.rst - doc/source/whatsnew/v0.10.1.rst - doc/source/whatsnew/v0.11.0.rst doc/source/whatsnew/v0.12.0.rst doc/source/whatsnew/v0.13.0.rst doc/source/whatsnew/v0.13.1.rst