1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
| Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy as np >>> import pandas as pd
>>> a = np.random.standard_normal((9,4)) >>> b = pd.DataFrame(a) >>> b.columns = [['num1','num2','num3','num4']] >>> a array([[-2.36198849, -1.27547933, -1.40351822, -0.6638619 ], [ 1.89159066, -0.31838519, -0.2065942 , -1.02327987], [-2.02771503, -0.81333254, -0.93644288, -0.91592467], [-1.3939496 , 0.25899342, 1.11591841, -0.7423286 ], [-1.05104415, -0.79069151, -1.46536873, -0.01449547], [ 1.32483444, 0.32030117, -1.23575344, 0.51455106], [ 0.91297435, 0.43242834, 1.77235337, 1.14879289], [ 0.93476429, 0.18592698, 0.30198234, -0.61861642], [ 0.04462872, -0.99275411, -0.86382085, -1.53064223]]) >>> b num1 num2 num3 num4 0 -2.361988 -1.275479 -1.403518 -0.663862 1 1.891591 -0.318385 -0.206594 -1.023280 2 -2.027715 -0.813333 -0.936443 -0.915925 3 -1.393950 0.258993 1.115918 -0.742329 4 -1.051044 -0.790692 -1.465369 -0.014495 5 1.324834 0.320301 -1.235753 0.514551 6 0.912974 0.432428 1.772353 1.148793 7 0.934764 0.185927 0.301982 -0.618616 8 0.044629 -0.992754 -0.863821 -1.530642 >>> b.sum() num1 -1.725905 num2 -2.992993 num3 -2.921244 num4 -3.845805 dtype: float64 >>> b.mean() num1 -0.191767 num2 -0.332555 num3 -0.324583 num4 -0.427312 dtype: float64
>>> h5 = pd.HDFStore('/data/stock/test1.h5','w') >>> h5['data'] = b >>> h5.close() >>> >>> b num1 num2 num3 num4 0 -2.361988 -1.275479 -1.403518 -0.663862 1 1.891591 -0.318385 -0.206594 -1.023280 2 -2.027715 -0.813333 -0.936443 -0.915925 3 -1.393950 0.258993 1.115918 -0.742329 4 -1.051044 -0.790692 -1.465369 -0.014495 5 1.324834 0.320301 -1.235753 0.514551 6 0.912974 0.432428 1.772353 1.148793 7 0.934764 0.185927 0.301982 -0.618616 8 0.044629 -0.992754 -0.863821 -1.530642
>>> h5 = pd.HDFStore('/data/stock/test1.h5','r') >>> c = h5['data'] >>> c num1 num2 num3 num4 0 -2.361988 -1.275479 -1.403518 -0.663862 1 1.891591 -0.318385 -0.206594 -1.023280 2 -2.027715 -0.813333 -0.936443 -0.915925 3 -1.393950 0.258993 1.115918 -0.742329 4 -1.051044 -0.790692 -1.465369 -0.014495 5 1.324834 0.320301 -1.235753 0.514551 6 0.912974 0.432428 1.772353 1.148793 7 0.934764 0.185927 0.301982 -0.618616 8 0.044629 -0.992754 -0.863821 -1.530642 >>> h5.close()
|