Skip to content

Commit 0a51020

Browse files
committed
Ensure cleaned numpy arrays are contiguous
1 parent 56a8945 commit 0a51020

File tree

1 file changed

+2
-2
lines changed
  • packages/python/plotly/plotly/io

1 file changed

+2
-2
lines changed

packages/python/plotly/plotly/io/_json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,15 +479,15 @@ def clean_to_json_compatible(obj, **kwargs):
479479
and isinstance(obj, np.ndarray)
480480
and obj.dtype.kind in ("b", "i", "u", "f")
481481
):
482-
return obj
482+
return np.ascontiguousarray(obj)
483483

484484
# pandas
485485
if pd is not None:
486486
if obj is pd.NaT:
487487
return None
488488
elif isinstance(obj, (pd.Series, pd.DatetimeIndex)):
489489
if numpy_allowed and obj.dtype.kind in ("b", "i", "u", "f"):
490-
return obj.values
490+
return np.ascontiguousarray(obj.values)
491491
elif obj.dtype.kind == "M":
492492
if isinstance(obj, pd.Series):
493493
dt_values = obj.dt.to_pydatetime().tolist()

0 commit comments

Comments
 (0)