Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #1191

Open
wahidur0547 opened this issue Mar 28, 2024 · 4 comments
Open

Error #1191

wahidur0547 opened this issue Mar 28, 2024 · 4 comments

Comments

@wahidur0547
Copy link

WhatsApp Image 2024-03-28 at 18 31 22

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??

@zhumingpassional
Copy link
Collaborator

the plot function should be revised. now that the result has been obtained, plotting fig is easy.

@VishnuRaghavan
Copy link

VishnuRaghavan commented May 30, 2024

"""
Script for comparing results with DJIA.

This script reads data from df_result_ensemble and df_dji, merges them, and visualizes the comparison.
"""

import necessary packages

import pandas as pd
import os
import matplotlib.pyplot as plt
from finrl.config import DATA_SAVE_DIR

Load df_result_ensemble data from the CSV file

df_result_ensemble = pd.read_csv(
os.path.join(DATA_SAVE_DIR, "df_result_ensemble.csv"), index_col="date"
)

load df_dji data from csv

df_dji = pd.read_csv(os.path.join(DATA_SAVE_DIR, "df_dji.csv"), index_col="date")

Merge DataFrames on index

result = pd.merge(df_result_ensemble, df_dji, left_index=True, right_index=True)

Save to CSV

result.to_csv(os.path.join(DATA_SAVE_DIR, "result.csv"))

Rename columns for clarity

result.columns = ["ensemble", "djia"]

Plotting the result

Set the backend to a suitable interactive backend

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")

Display the plot interactively

plt.show()

@zhumingpassional
Copy link
Collaborator

@VishnuRaghavan
can your code successfully plot the figure? if yes, pls submit a PR

@VishnuRaghavan
Copy link

VishnuRaghavan commented May 31, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants