-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[Python] Add conversion to/from Pandas/Python for Month, Day Nano Interval Type #29432
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
Joris Van den Bossche / @jorisvandenbossche: For proper conversion to/from Python, the question is also what kind of value to use on the Python side. AFAIK there is not really a Python scalar from the standard library that represents such interval values ( For numpy-based conversion, the Months unit could be represented by "timedelta64[M]", as both are a count of number of months (although not a zero-copy conversion, since in numpy it's always 64bit). But for DayTime and MonthDayNano, there is no equivalent (or maybe as a numpy record/struct array?). |
Micah Kornfield / @emkornfield:
I'll try to tackle conversion of the existing types as well. After reviewing I'll try to make reasonable choices but if there are strong inclinations. For standard python types my inclination is to map: DayMillis to datetime.timedelta (according to docs it stores days, seconds and microseconds as separate fields). Not sure about the reverse mapping though For numpy-based conversion of months, timedelta64[M] sounds good to me.
For month day nanos, I think if DateOffset doesn't work for numpy, the struct type seems correct to me. For python, I think maybe just a triple (namedtuple) in the arrow namespace might make sense. |
Tim Swast / @tswast: The package appears to be widely used and from what I can tell from https://github.com/dateutil/dateutil no additional transitive dependencies to worry about. That said, a namedtuple or dict where the names match the arguments to relativedelta (months, days, microseconds) would be pretty easy to convert to a relativedelta if not. |
Micah Kornfield / @emkornfield: |
Micah Kornfield / @emkornfield:
|
Joris Van den Bossche / @jorisvandenbossche: |
Joris Van den Bossche / @jorisvandenbossche: Maybe one note that we could also do this in several PRs (eg already start with plain Python tuples conversion, so we have at least basic bindings for the interval type; cfr ARROW-14018) |
Micah Kornfield / @emkornfield: |
Antoine Pitrou / @pitrou: |
Uh oh!
There was an error while loading. Please reload this page.
#10177 has been merged we should support conversion to and from this type for standard python surface areas.
Reporter: Micah Kornfield / @emkornfield
Assignee: Micah Kornfield / @emkornfield
Related issues:
PRs and other links:
Note: This issue was originally created as ARROW-13806. Please see the migration documentation for further details.
The text was updated successfully, but these errors were encountered: