Skip to content

Commit 63c1771

Browse files
committed
Send a pandas Index down the existing Series path
1 parent 727807b commit 63c1771

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎_plotly_utils/basevalidators.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,9 @@ def copy_to_readonly_numpy_array(v, kind=None, force_numeric=False):
106106
}
107107

108108
pd = get_module("pandas", should_load=False)
109-
if pd is not None and isinstance(v, pd.DatetimeIndex) and v.tz is not None:
110-
# Remove time zone so that local time is displayed, and so that converting
111-
# to numpy doesn't result in object dtype
112-
v = v.tz_localize(None)
109+
if pd is not None and isinstance(v, pd.Index):
110+
# Narwhals passes an Index through unchanged, so use the Series path for it
111+
v = v.to_series()
113112

114113
# With `pass_through=True`, the original object will be returned if unable to convert
115114
# to a Narwhals DataFrame or Series.

0 commit comments

Comments
 (0)