Open wahidur0547 opened 3 months ago
the plot function should be revised. now that the result has been obtained, plotting fig is easy.
""" Script for comparing results with DJIA.
This script reads data from df_result_ensemble and df_dji, merges them, and visualizes the comparison. """
import pandas as pd import os import matplotlib.pyplot as plt from finrl.config import DATA_SAVE_DIR
df_result_ensemble = pd.read_csv( os.path.join(DATA_SAVE_DIR, "df_result_ensemble.csv"), index_col="date" )
df_dji = pd.read_csv(os.path.join(DATA_SAVE_DIR, "df_dji.csv"), index_col="date")
result = pd.merge(df_result_ensemble, df_dji, left_index=True, right_index=True)
result.to_csv(os.path.join(DATA_SAVE_DIR, "result.csv"))
result.columns = ["ensemble", "djia"]
plt.switch_backend("TkAgg") # Use 'TkAgg' backend for Tkinter-based interactive display plt.rcParams["figure.figsize"] = (15, 5) plt.figure() result.plot() plt.title("Ensemble and DJIA Comparison") plt.xlabel("Date") plt.ylabel("Values")
plt.show()
@VishnuRaghavan can your code successfully plot the figure? if yes, pls submit a PR
@zhumingpassional I'm running on my local machine I have split the colab file into multiple files the above code is for comparison with DJIA. Also I'm training it on my CUDA NVIDIA GPU. Making a PR would not be the best solution as the file architectures are now different.
And yes for me plotting is working fine with this setup.
I am getting AttributeError: 'Series' object has no attribute 'iteritems' i tried but not able to fix it, can someone help me with this error??