-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Date Operations #10297
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
Comments
I think the trickiness is that Months/Years are no longer a set length (in nanonseconds), so it's trickier to divide them... when you subtract you get a timedelta but you can't write this in terms of Month/Year. I think this means you have to check each tuple part to get this info, you can't do anything clever. Hmmmm, I was going to say that intnx is solved with offsets (this looks like a bug; seems like the way it ought to work):
The names of these SAS functions are truly awful!!! |
You want this. @hayd the first argument to
|
I suppose the docs could be improved slightly. pandas provides extreme flexibility. http://pandas.pydata.org/pandas-docs/stable/timeseries.html#dateoffset-objects. Though they are pretty complete. |
IMHO, two date functions from
SAS
can be very useful and straight forward. I wonder if they can be incorporated in Pandas.intck()
This function computes the difference between 2 dates/datetime with specified units. For example
Assume:
d1=1992-03-20
andd2=1992-06-12
. And these are all ofdate
type in SAS.intck('month', d1, d2)
yields 3 (regardless of what day it is).intck('qtr', d1, d2)
yields 1.intck('year', d1, d2)
yields 0.intnx()
This function increments a given date by an interval. Assuming
d1=1992-03-20
,intnx('month', d1, 3, 'end')
yields 1992-06-30 (increase month by 3 and return the last day of that month.intnx('month', d1, 3, 'same')
yields 1992-06-20 (increase month by 3 and return the same day of that month.As you can see, these two functions are very flexible and simple. The whole
offset
system seems to be a little too cumbersome comparing to these 2.See this question too. Especially the solution offered by @hayd
The text was updated successfully, but these errors were encountered: