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: Make pd.Timestamp.astimezone() default to local timezone #60692

Open
2 of 3 tasks
powellnorma opened this issue Jan 11, 2025 · 1 comment
Open
2 of 3 tasks

ENH: Make pd.Timestamp.astimezone() default to local timezone #60692

powellnorma opened this issue Jan 11, 2025 · 1 comment
Labels
API Design Enhancement Localization Internationalization of data Needs Discussion Requires discussion from core team before further action

Comments

@powellnorma
Copy link

powellnorma commented Jan 11, 2025

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
pd.Timestamp.now().astimezone()

However, for datetime objects this is no problem, it uses the local timezone as default:

from datetime import datetime
datetime.now().astimezone()

Issue Description

It would be great if Timestamp.astimezone() would work like it does for the original datetime, so that e.g. a function that accepts a datetime doesn't have to treat pd.Timestamp (which inherits datetime) differently

Expected Behavior

Timestamp.astimezone should work like it does for the original datetime (choosing the local timezone)

Installed Versions

pandas : 2.2.2
numpy : 1.26.4
pytz : 2022.7.1
dateutil : 2.8.2
Cython : 3.0.11
pytest : 7.4.0

@powellnorma powellnorma added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 11, 2025
@rhshadrach rhshadrach added Enhancement API Design Localization Internationalization of data Needs Discussion Requires discussion from core team before further action and removed Needs Triage Issue that has not been reviewed by a pandas team member Bug labels Jan 11, 2025
@rhshadrach rhshadrach changed the title BUG: pd.Timestamp.astimezone() throws TypeError ENH: Make pd.Timestamp.astimezone() default to local timezone Jan 11, 2025
@rhshadrach
Copy link
Member

rhshadrach commented Jan 11, 2025

Thanks for the report. This is behaving as documented, so this is not a bug. Rephrased as an enhancement request.

cc @jbrockmendel for any thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Enhancement Localization Internationalization of data Needs Discussion Requires discussion from core team before further action
Projects
None yet
Development

No branches or pull requests

2 participants