You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@shoyer thoughts on how to resolve this? We can continue dropping the timezone and passing datetime64[ns], break API and return an object-dtype array of timestamps, or add a parameter so that the user can control this.
The text was updated successfully, but these errors were encountered:
This is a little tough: xarray doesn't know what users would prefer in general, either.
In principle, the old behavior was a bug, since we were silently dropping timezones -- though I'm sure some users may have been relying on this. Perhaps the cleanest solution would be to add a dtypes argument on an xarray side to allow users to silence the warning.
Either way, this is definitely an xarray bug (pydata/xarray#2666), because xarray handle pandas's to_xarray() method by forwarding to xarray.Dataset.from_dataframe.
For pandas, I would suggest that to_xarray() be augmented to pass on **kwargs to the xarray from_dataframe and from_series constructors. That would give us the flexibility to fix this on the xarray side.
@shoyer I’ve been agitating to make EA allow non-1D arrays, partly so it could be portable enough to be useful directly in e.g. xarray. If we were to put that in place, would just reshaping the EA be a viable option here?
I don’t know if it’s worth the trouble of ensuring that all extension arrays can handle n-dimensions. My thinking was that the best way to handle this would be to write an adapter that adds shape information to flat pandas objects (either Series or ExtensionArray) that conforms to numpy’s new ‘array_function‘ protocol. That’s basically what we would want for xarray.
@shoyer thoughts on how to resolve this? We can continue dropping the timezone and passing datetime64[ns], break API and return an object-dtype array of timestamps, or add a parameter so that the user can control this.
The text was updated successfully, but these errors were encountered: