def save_fund_data(df, file_path): if df is None: return old_df = util.get_dataframe_from_file(file_path) if old_df is not None: old_df = old_df.set_index('price_dt') result = df.combine_first(old_df) # accept new data, but in case lose old data, use combine_first result.to_csv(file_path) else: df.to_csv(file_path)
def load_all_funds_file(file_path): df = util.get_dataframe_from_file(file_path) if df is not None: df = df.set_index('fundb_base_fund_id') return df