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

Add .dt.replace() to alter date/datetime values #18287

Closed
mcrumiller opened this issue Aug 20, 2024 · 3 comments
Closed

Add .dt.replace() to alter date/datetime values #18287

mcrumiller opened this issue Aug 20, 2024 · 3 comments
Labels
enhancement New feature or an improvement of an existing feature

Comments

@mcrumiller
Copy link
Contributor

Description

It would be really nice to have the equivalent of datetime.replace/date.replace, as in:

>>> from datetime import date
>>> d = date(2024, 1, 1)
>>> d.replace(year=2022, month=4, day=5)
datetime.date(2022, 4, 5)

The equivalent would be:

>>> from datetime import date
>>> s = pl.Series([date(2024, 1, 1)])
>>> s.dt.replace(year=2022, month=4, day=5)
shape: (1,)
Series: '' [date]
[
        2022-04-05
]
@mcrumiller mcrumiller added the enhancement New feature or an improvement of an existing feature label Aug 20, 2024
@MarcoGorelli
Copy link
Collaborator

I think it's the 3rd time you make this request 😉 #15794 #8879

@mcrumiller
Copy link
Contributor Author

Ahh geez....sorry. Ouch.

@MarcoGorelli
Copy link
Collaborator

😄 no worries, it's probably a sign that it'd be pretty useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants