-
-
Notifications
You must be signed in to change notification settings - Fork 75
Closed
Description
Normally, plotly allows one not to specify (the only) column of a series one is plotting. So the following code works fine:
fig = go.Figure()
ser = pd.Series(index = np.arange(100), data = {'a': np.arange(100)})
fig.add_trace(
go.Scattergl(
x=ser.index,
y=ser,
)
fig.show()
However, it fails when combining it with the FigureResampler with the following error:
C:\tools\miniconda3\envs\stat-analysis-3.7\lib\site-packages\plotly_resampler\figure_resampler.py in add_trace(self, trace, max_n_samples, downsampler, limit_to_view, hf_x, hf_y, hf_hovertext, **trace_kwargs)
531 if pd.isna(hf_y).any():
532 not_nan_mask = ~pd.isna(hf_y)
--> 533 hf_x = hf_x[not_nan_mask]
534 hf_y = hf_y[not_nan_mask]
535 if isinstance(hf_hovertext, np.ndarray):
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
The problem is solved by specifying the column of the series to plot, i.e. y=ser['a']. It took me several minutes to find it though and I guess plotly-resampler was designed to be transparent.
Perhaps, an if instance(pd.Series) could be added to treat this specific case? Or could there be another way for checking if isna that works for such series as well?
In any way, thanks for the great software!
Metadata
Metadata
Assignees
Labels
No labels