-
Notifications
You must be signed in to change notification settings - Fork 11
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
Calculating time #214
Comments
Hmm I'll have to look into this more. At first glance there isn't a "simple translation". There might have to be a tidypolars helper for this. |
For now I'd recommend using FYI this method is built into the import tidypolars as tp
from tidypolars import col
df = tp.Tibble(date = ['2021-01-01', '2021-10-01']).mutate(date = col('date').str.strptime(tp.Date))
(
df
.mutate(minus_two_months = col('date').dt.offset_by("-2mo"),
add_year = col('date').dt.offset_by("1y"))
)
|
Workaround (not exactly a solution) -- use I'm having problem with filtering/date comparison. I just added the
Here is R's equivalent:
|
(Link is dead) |
In R with
lubridate
, it would look like this:But in
tidypolars
functions list, there doesn't seem to be ayears
ormonths
function: https://tidypolars.readthedocs.io/en/latest/reference.htmlThe text was updated successfully, but these errors were encountered: