diff --git a/my_test.py b/my_test.py index ae6a0c8..ea48a2d 100644 --- a/my_test.py +++ b/my_test.py @@ -23,7 +23,8 @@ def colsum(data, keys): store = pd.HDFStore('test.h5') if 1: - df = pd.DataFrame(np.array([[1, 2, 3, 101], [4, 5, 6, 102], [7, 8, 9, 103], [10, 11, 12, 104]]),columns=['high', 'low', 'open', 'close']) + index = pd.date_range('1/1/2001', periods=4, freq='D') + df = pd.DataFrame(np.array([[1, 2, 3, 101], [4, 5, 6, 102], [7, 8, 9, 103], [10, 11, 12, 104]]),columns=['high', 'low', 'open', 'close'], index=index) store['df'] = df else: df = store['df'] @@ -33,7 +34,7 @@ df['colsum'] = colsum(df, ['high', 'low', 'open', 'close']) df['ema(colsum)'] = ema(df, 'colsum') # Print table -print(df) +print(df.loc['2001-01-01':'2001-01-02']) # Plot graph df.plot()