Closed darynwhite closed 1 year ago
Hi @darynwhite, thank you for submitting this issue!
Can you provide a minimal example and the used plotly-resampler version which raises this error. This helps us tremendously to pinpoint and resolve the issue!
Kind regards, Jonas
I just updated to the 0.9.0rc2
release and the problem persists from 0.9.0rc0
.
I've attached the data that I'm attempting to display via Dash. This example script follows the best I can quickly write that raises the issue and roughly displays what I'm attempting to plot.
import pandas, plotly.graph_objects as plgo, plotly_resampler as resampler
from datetime import timedelta
data = pandas.read_csv("airtemp-test-data.csv", index_col="Observation Time (UTC)")
data.index = pandas.to_datetime(data.index)
data.index.freq = "10T"
fig = plgo.Figure(
layout=plgo.Layout(
title=dict(
text=f"AirT test timeseries", y=0.98, x=0.5, xanchor="center", yanchor="top"
),
xaxis=dict(title=data.index.name, type="date"),
yaxis=dict(title="Air Temp (ºC)", range=[20, 30], fixedrange=True),
template="seaborn",
margin=dict(l=50, r=50, t=50, b=50, pad=5),
showlegend=True,
)
)
plot = resampler.FigureResampler(fig)
plot.add_traces(
[plgo.Scattergl(x=data.index, y=data["AirT"], mode="markers", name=f"AirT")]
)
plot.add_vline(x=data.index[0])
plot.add_vline(x=data.index[-1])
start = data.index[0] - timedelta(hours=48)
end = data.index[-1] + timedelta(hours=48)
plot.update_xaxes(range=[start, end])
plot.show_dash()
@darynwhite,
It seems that the issue is related to the plot.update_xaxes(range=[start, end])
code line and pandas>=2.0
causes this to fail (datetimes and timezones are handled slightly different there).
I will try to fix this issue with a PR and create a test for this, so this will not occur anymore in later versions!
Hey @darynwhite, can you confirm that plotly-resampler==0.9.0rc3
fixes this issue?
The error doesn't show, a new one does tho, but that is attached to an update from dash-extensions
Here is the line referenced in the raised error: https://github.com/predict-idlab/plotly-resampler/blob/8fbb0f421781dac895000faddef2014256fd99bc/plotly_resampler/aggregation/plotly_aggregator_parser.py#LL41C17-L41C17
And here is the traceback that follows the
plotly-resampler
code: