@@ -5,11 +5,6 @@ v0.10.1 (January 22, 2013)
55
66{{ header }}
77
8- .. ipython :: python
9- :suppress:
10-
11- from pandas import * # noqa F401, F403
12-
138
149This is a minor release from 0.10.0 and includes new features, enhancements,
1510and bug fixes. In particular, there is substantial new HDFStore functionality
@@ -48,24 +43,27 @@ You may need to upgrade your existing data files. Please visit the
4843 :suppress:
4944 :okexcept:
5045
46+ import os
47+
5148 os.remove(' store.h5' )
5249
5350 You can designate (and index) certain columns that you want to be able to
5451perform queries on a table, by passing a list to ``data_columns ``
5552
5653.. ipython :: python
5754
58- store = HDFStore(' store.h5' )
59- df = DataFrame(randn(8 , 3 ), index = date_range(' 1/1/2000' , periods = 8 ),
60- columns = [' A' , ' B' , ' C' ])
55+ store = pd.HDFStore(' store.h5' )
56+ df = pd.DataFrame(np.random.randn(8 , 3 ),
57+ index = pd.date_range(' 1/1/2000' , periods = 8 ),
58+ columns = [' A' , ' B' , ' C' ])
6159 df[' string' ] = ' foo'
6260 df.loc[df.index[4 :6 ], ' string' ] = np.nan
6361 df.loc[df.index[7 :9 ], ' string' ] = ' bar'
6462 df[' string2' ] = ' cool'
6563 df
6664
6765 # on-disk operations
68- store.append(' df' , df, data_columns = [' B' ,' C' ,' string' ,' string2' ])
66+ store.append(' df' , df, data_columns = [' B' , ' C' , ' string' , ' string2' ])
6967 store.select(' df' , " B>0 and string=='foo'" )
7068
7169 # this is in-memory version of this type of selection
@@ -77,16 +75,16 @@ Retrieving unique values in an indexable or data column.
7775
7876 # note that this is deprecated as of 0.14.0
7977 # can be replicated by: store.select_column('df','index').unique()
80- store.unique(' df' ,' index' )
81- store.unique(' df' ,' string' )
78+ store.unique(' df' , ' index' )
79+ store.unique(' df' , ' string' )
8280
8381 You can now store ``datetime64 `` in data columns
8482
8583.. ipython :: python
8684
87- df_mixed = df.copy()
88- df_mixed[' datetime64' ] = Timestamp(' 20010102' )
89- df_mixed.loc[df_mixed.index[3 :4 ], [' A' ,' B' ]] = np.nan
85+ df_mixed = df.copy()
86+ df_mixed[' datetime64' ] = pd. Timestamp(' 20010102' )
87+ df_mixed.loc[df_mixed.index[3 :4 ], [' A' , ' B' ]] = np.nan
9088
9189 store.append(' df_mixed' , df_mixed)
9290 df_mixed1 = store.select(' df_mixed' )
@@ -99,21 +97,21 @@ columns, this is equivalent to passing a
9997
10098.. ipython :: python
10199
102- store.select(' df' ,columns = [' A' ,' B' ])
100+ store.select(' df' , columns = [' A' , ' B' ])
103101
104102 ``HDFStore `` now serializes MultiIndex dataframes when appending tables.
105103
106104.. code-block :: ipython
107105
108- In [19]: index = MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'],
109- ....: ['one', 'two', 'three']],
110- ....: labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3],
111- ....: [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]],
112- ....: names=['foo', 'bar'])
106+ In [19]: index = pd. MultiIndex(levels=[['foo', 'bar', 'baz', 'qux'],
107+ ....: ['one', 'two', 'three']],
108+ ....: labels=[[0, 0, 0, 1, 1, 2, 2, 3, 3, 3],
109+ ....: [0, 1, 2, 0, 1, 1, 2, 0, 1, 2]],
110+ ....: names=['foo', 'bar'])
113111 ....:
114112
115- In [20]: df = DataFrame(np.random.randn(10, 3), index=index,
116- ....: columns=['A', 'B', 'C'])
113+ In [20]: df = pd. DataFrame(np.random.randn(10, 3), index=index,
114+ ....: columns=['A', 'B', 'C'])
117115 ....:
118116
119117 In [21]: df
@@ -131,7 +129,7 @@ columns, this is equivalent to passing a
131129 two -3.207595 -1.535854 0.409769
132130 three -0.673145 -0.741113 -0.110891
133131
134- In [22]: store.append('mi',df)
132+ In [22]: store.append('mi', df)
135133
136134 In [23]: store.select('mi')
137135 Out[23]:
@@ -162,26 +160,28 @@ combined result, by using ``where`` on a selector table.
162160
163161.. ipython :: python
164162
165- df_mt = DataFrame(randn(8 , 6 ), index = date_range(' 1/1/2000' , periods = 8 ),
166- columns = [' A' , ' B' , ' C' , ' D' , ' E' , ' F' ])
163+ df_mt = pd.DataFrame(np.random.randn(8 , 6 ),
164+ index = pd.date_range(' 1/1/2000' , periods = 8 ),
165+ columns = [' A' , ' B' , ' C' , ' D' , ' E' , ' F' ])
167166 df_mt[' foo' ] = ' bar'
168167
169168 # you can also create the tables individually
170- store.append_to_multiple({ ' df1_mt' : [' A' ,' B' ], ' df2_mt' : None }, df_mt, selector = ' df1_mt' )
169+ store.append_to_multiple({' df1_mt' : [' A' , ' B' ], ' df2_mt' : None },
170+ df_mt, selector = ' df1_mt' )
171171 store
172172
173173 # indiviual tables were created
174174 store.select(' df1_mt' )
175175 store.select(' df2_mt' )
176176
177177 # as a multiple
178- store.select_as_multiple([' df1_mt' ,' df2_mt' ], where = [ ' A>0' ,' B>0' ], selector = ' df1_mt' )
178+ store.select_as_multiple([' df1_mt' , ' df2_mt' ], where = [' A>0' , ' B>0' ],
179+ selector = ' df1_mt' )
179180
180181 .. ipython :: python
181182 :suppress:
182183
183184 store.close()
184- import os
185185 os.remove(' store.h5' )
186186
187187 **Enhancements **
0 commit comments