(fix): don't handle time-dtypes as extension arrays in from_dataframe
#9042
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is probably the simplest way to fix the bug but I now have many questions about
PandasIndexingAdapter
. I initially attempted to make datetime dtypes go intoExtensionArray
(because they are extension arrays) but there are so many tests with behavior that I don't understand that this seemed easier. Primarily, my issue with doing that wasn't that the tests broke in a way that was "this behavior doesn't make sense" but rather "this behavior makes more sense than what the test expects" i.e., there were a number of places where tests expect datetime dtypes to not be preserved, but they are preserved by usingExtensionArray
. But I don't understand why certain things are expected or not. For example:xarray/xarray/tests/test_variable.py
Lines 2967 to 2968 in 026aa7c
became a condition that expected the
dtype
be preserved and not just blanket converting everything tonp.dtype("datetime64[ns]")
i.e., thedtype
onvar
remainedpd.DatetimeTZDtype("s", pytz.timezone("America/New_York"))
whats-new.rst
api.rst