Skip to content

DOC: Slight clarification regarding date_range and timezones #49764

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

Merged
merged 1 commit into from Nov 21, 2022
Merged

DOC: Slight clarification regarding date_range and timezones #49764

merged 1 commit into from Nov 21, 2022

Conversation

aberres
Copy link
Contributor

@aberres aberres commented Nov 18, 2022

If a timezone-aware datetime-like gets passed, it's timezone gets used as expected. From reading the docs I had the impression that the timezone would be ignored.

@@ -915,7 +915,7 @@ def date_range(
tz : str or tzinfo, optional
Time zone name for returning localized DatetimeIndex, for example
'Asia/Hong_Kong'. By default, the resulting DatetimeIndex is
timezone-naive.
timezone-naive unless timezone-aware datetime-likes are passed.
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 to the Examples section below demonstrating this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mroeschke Added. Please have a look.

@mroeschke mroeschke added Docs Datetime Datetime data dtype Timezones Timezone data dtype labels Nov 18, 2022
If a timezone-aware datetime-like gets passed, it's timezone gets used as
expected.
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Nice, I think it's good to clarify this, thanks @aberres !

@mroeschke mroeschke added this to the 2.0 milestone Nov 21, 2022
@MarcoGorelli MarcoGorelli merged commit 450f051 into pandas-dev:main Nov 21, 2022
mliu08 pushed a commit to mliu08/pandas that referenced this pull request Nov 27, 2022
…dev#49764)

If a timezone-aware datetime-like gets passed, it's timezone gets used as
expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Docs Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants