diff --git a/xarray/core/accessor_dt.py b/xarray/core/accessor_dt.py index 86e875cab5c..f91bdd11f5d 100644 --- a/xarray/core/accessor_dt.py +++ b/xarray/core/accessor_dt.py @@ -206,7 +206,7 @@ def _strftime_through_cftimeindex(values, date_format: str): values_as_cftimeindex = CFTimeIndex(duck_array_ops.ravel(values)) field_values = values_as_cftimeindex.strftime(date_format) - return field_values.values.reshape(values.shape) + return field_values.to_numpy().reshape(values.shape) def _strftime_through_series(values, date_format: str): @@ -215,7 +215,7 @@ def _strftime_through_series(values, date_format: str): """ values_as_series = pd.Series(duck_array_ops.ravel(values), copy=False) strs = values_as_series.dt.strftime(date_format) - return strs.values.reshape(values.shape) + return strs.to_numpy().reshape(values.shape) def _strftime(values, date_format):