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: date_range support reso keyword #49106

Merged
merged 15 commits into from
Nov 18, 2022

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.

@mroeschke mroeschke added Datetime Datetime data dtype Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Oct 17, 2022
@mroeschke mroeschke added this to the 2.0 milestone Nov 7, 2022
@@ -61,8 +61,10 @@ Other enhancements
- :class:`.CategoricalConversionWarning`, :class:`.InvalidComparison`, :class:`.InvalidVersion`, :class:`.LossySetitemError`, and :class:`.NoBufferPresent` are now exposed in ``pandas.errors`` (:issue:`27656`)
- Fix ``test`` optional_extra by adding missing test package ``pytest-asyncio`` (:issue:`48361`)
- :func:`DataFrame.astype` exception message thrown improved to include column name when type conversion is not possible. (:issue:`47571`)
- :func:`date_range` now supports a ``unit`` keyword ("s", "ms", "us", or "ns") to specify the desired resolution of the output index (:issue:`49106`)
Copy link
Member

Choose a reason for hiding this comment

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

Also another reminder that in a future PR it would be good to collect all these non-nano updates and introduce them in a separate section

Copy link
Member Author

Choose a reason for hiding this comment

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

planning to do this once the astype and constructor stuff is all in

@@ -856,6 +858,10 @@ def date_range(
Include boundaries; Whether to set each bound as closed or open.

.. versionadded:: 1.4.0
unit : str, default None
Copy link
Member

Choose a reason for hiding this comment

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

Could you add an example in the Examples section below?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated+green

@mroeschke mroeschke merged commit a99c1ad into pandas-dev:main Nov 18, 2022
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the nano-date_range branch November 18, 2022 23:40
mliu08 pushed a commit to mliu08/pandas that referenced this pull request Nov 27, 2022
* ENH: date_range support reso keyword

* GH ref

* pyright ignore

* reso->unit

* raise if endpoints cant cast losslessly

* add assertions

* mypy fixup

* example with unit

* typo fixup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants