Commits


Dane Pitkin authored and GitHub committed 4f56aba35bc
GH-33321: [Python] Support converting to non-nano datetime64 for pandas >= 2.0 (#35656) Do not coerce temporal types to nanosecond when pandas >= 2.0 is imported, since pandas now supports s/ms/us time units. This PR adds support for the following Arrow -> Pandas conversions, which previously all defaulted to `datetime64[ns]` or `datetime64[ns, <TZ>]`: ``` date32 -> datetime64[ms] date64 -> datetime64[ms] datetime64[s] -> datetime64[s] datetime64[ms] -> datetime64[ms] datetime64[us] -> datetime64[us] datetime64[s, <TZ>] -> datetime64[s, <TZ>] datetime64[ms, <TZ>] -> datetime64[ms, <TZ>] datetime64[us, <TZ>] -> datetime64[us, <TZ>] ``` ### Rationale for this change Pandas 2.0 introduces proper support for temporal types. ### Are these changes tested? Yes. Pytests added and updated. ### Are there any user-facing changes? Yes, arrow-to-pandas default conversion behavior will change when users have pandas >= 2.0, but a legacy option is exposed to provide backwards compatibility. * Closes: #33321 Lead-authored-by: Dane Pitkin <dane@voltrondata.com> Co-authored-by: Dane Pitkin <48041712+danepitkin@users.noreply.github.com> Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com> Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>