Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: non-nano datetime64s for read_sas #56127

Merged
merged 13 commits into from
Dec 5, 2023
Merged

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Pre-empts a bunch of the remaining test failures in #55901.

cc @ChadFulton for help determing what the correct "expected"s should be.

@mroeschke mroeschke added IO SAS SAS: read_sas Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Nov 26, 2023
@@ -188,6 +188,7 @@ Other enhancements
- :meth:`to_sql` with method parameter set to ``multi`` works with Oracle on the backend
- :attr:`Series.attrs` / :attr:`DataFrame.attrs` now uses a deepcopy for propagating ``attrs`` (:issue:`54134`).
- :func:`read_csv` now supports ``on_bad_lines`` parameter with ``engine="pyarrow"``. (:issue:`54480`)
- :func:`read_sas` returns ``datetime64`` dtypes with resolutions better matching those stored natively in SAS, and avoids returning object-dtype in cases that cannot be help with ``datetime64[ns]`` dtype (:issue:`56127`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- :func:`read_sas` returns ``datetime64`` dtypes with resolutions better matching those stored natively in SAS, and avoids returning object-dtype in cases that cannot be help with ``datetime64[ns]`` dtype (:issue:`56127`)
- :func:`read_sas` returns ``datetime64`` dtypes with resolutions better matching those stored natively in SAS, and avoids returning object-dtype in cases that cannot be stored with ``datetime64[ns]`` dtype (:issue:`56127`)

?

@@ -62,6 +58,10 @@
)


_unix_origin = Timestamp("1970-01-01")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these be reused in the future? Otherwise could just inline the 10 year timedelta in _convert_datetimes

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either way. i think this is nicely clear about where the 10 year difference stems from (also cant do Timedelta(years=10))

@mroeschke mroeschke added this to the 2.2 milestone Dec 5, 2023
@mroeschke mroeschke merged commit 33ff3d9 into pandas-dev:main Dec 5, 2023
44 checks passed
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the tst-sas branch December 5, 2023 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IO SAS SAS: read_sas Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants