diff --git a/Examples/Basic/tutorial1.py b/Examples/Basic/tutorial1.py index 7ea254f96..8e183d0a7 100644 --- a/Examples/Basic/tutorial1.py +++ b/Examples/Basic/tutorial1.py @@ -51,6 +51,12 @@ def main(): ldf_data = c_dataobj.get_data(ldt_timestamps, ls_symbols, ls_keys) d_data = dict(zip(ls_keys, ldf_data)) + # Filling the data for NAN + for s_key in ls_keys: + d_data[s_key] = d_data[s_key].fillna(method='ffill') + d_data[s_key] = d_data[s_key].fillna(method='bfill') + d_data[s_key] = d_data[s_key].fillna(1.0) + # Getting the numpy ndarray of close prices. na_price = d_data['close'].values diff --git a/Examples/Basic/tutorial3.py b/Examples/Basic/tutorial3.py index 12d08f20f..422fce947 100644 --- a/Examples/Basic/tutorial3.py +++ b/Examples/Basic/tutorial3.py @@ -77,6 +77,7 @@ def main(): # Filling the data. df_rets = df_rets.fillna(method='ffill') df_rets = df_rets.fillna(method='bfill') + df_rets = df_rets.fillna(1.0) # Numpy matrix of filled data values na_rets = df_rets.values diff --git a/Examples/Basic/tutorial5.py b/Examples/Basic/tutorial5.py index 877ae20b2..50bec0827 100644 --- a/Examples/Basic/tutorial5.py +++ b/Examples/Basic/tutorial5.py @@ -46,6 +46,9 @@ def main(): # Reading just the close prices df_close = c_dataobj.get_data(ldt_timestamps, ls_symbols, "close") + df_close = df_close.fillna(method='ffill') + df_close = df_close.fillna(method='bfill') + df_close = df_close.fillna(1.0) # Creating the allocation dataframe # We offset the time for the simulator to have atleast one