Skip to content

PERF: Timestamp construction with tz and string offset #55748

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
Oct 29, 2023

Conversation

jbrockmendel
Copy link
Member

import pandas as pd

dtstr = "2016-01-01 02:03:04-07:00"
tz = "US/Pacific"

%timeit pd.Timestamp(dtstr, tz=tz)
31.6 µs ± 318 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)  # <- branch
33.5 µs ± 196 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each)  # <- main

Small bump from avoiding some object creation. The underlying motivation is moving towards aligning/de-duplicating the code we use in the several places that we use string_to_dts.

@mroeschke mroeschke added this to the 2.2 milestone Oct 29, 2023
@mroeschke mroeschke added Performance Memory or execution speed performance Timestamp pd.Timestamp and associated methods labels Oct 29, 2023
@mroeschke mroeschke merged commit 8425c97 into pandas-dev:main Oct 29, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ref-create_tsobject branch October 29, 2023 02:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Memory or execution speed performance Timestamp pd.Timestamp and associated methods
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants