This commit is contained in:
Stefano Ariestasia 2023-01-09 12:33:27 +09:00
parent b2791836a4
commit 5372e299c0

View File

@ -195,14 +195,14 @@ def trim_dataframes(preprocessed: Dict[str, DataFrame], timerange,
""" """
processed: Dict[str, DataFrame] = {} processed: Dict[str, DataFrame] = {}
for pair, df in preprocessed.items(): for pair, df in preprocessed.items():
trimed_df = trim_dataframe(df, timerange, startup_candles=startup_candles) trimmed_df = trim_dataframe(df, timerange, startup_candles=startup_candles)
if not trimed_df.empty: if not trimmed_df.empty:
# start_mem = trimed_df.memory_usage().sum() / 1024**2 # start_mem = trimmed_df.memory_usage().sum() / 1024**2
# logger.info(f"Memory usage of df for {pair} before reduced is {start_mem:.2f} MB") # logger.info(f"Memory usage of df for {pair} before reduced is {start_mem:.2f} MB")
trimed_df = reduce_mem_usage(pair, trimed_df) trimmed_df = reduce_mem_usage(pair, trimmed_df)
# end_mem = trimed_df.memory_usage().sum() / 1024**2 # end_mem = trimmed_df.memory_usage().sum() / 1024**2
# logger.info(f"Memory usage of df for {pair} after reduced is {end_mem:.2f} MB") # logger.info(f"Memory usage of df for {pair} after reduced is {end_mem:.2f} MB")
processed[pair] = trimed_df processed[pair] = trimmed_df
else: else:
logger.warning(f'{pair} has no data left after adjusting for startup candles, ' logger.warning(f'{pair} has no data left after adjusting for startup candles, '
f'skipping.') f'skipping.')