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

Fix plots: Make load_over_time Function Dynamic #Issue 209 #210

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

tichmangono
Copy link

Plotting with the load_over_time function was giving an error due to hardcoded indexes to select columns to be plotted. I suggest changes to make this part dynamic so it will plot only the numerical columns and only when there are numerical columns. Also wrote a comprehensive set of tests for the function with different test cases.

Problem code to reproduce error:

import gridstatus
import plotly.express as px
import pandas as pd

iso = gridstatus.PJM()
df = iso.get_load(date="today")

gridstatus.viz.load_over_time(df, iso="PJM")

The error seen:

`ValueError: Plotly Express cannot process wide-form data with columns of different type.`

Solution
Used pandas column datatype filters to identify numerical columns, then pass these to be plotted as the dependent variables (y)

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

Successfully merging this pull request may close these issues.

1 participant