westonpace commented on a change in pull request #11302:
URL: https://github.com/apache/arrow/pull/11302#discussion_r723744352
##########
File path: python/pyarrow/types.pxi
##########
@@ -2176,6 +2176,14 @@ def duration(unit):
return out
+def month_day_nano_interval():
+ """
+ Create instance of an interval representing months, days and nanoseconds
+ between two dates.
Review comment:
```suggestion
A type for intervals representing months, days and nanoseconds
between two dates.
```
Nit: Primitive types are cached so no instances are created (usually) and
the wording here sounds like it is creating intervals and not types.
##########
File path: python/pyarrow/array.pxi
##########
@@ -163,6 +163,12 @@ def array(object obj, type=None, mask=None, size=None,
from_pandas=None,
representation). Timezone-naive data will be implicitly interpreted as
UTC.
+ Pandas's DateOffsets and dateutil.relativedelta.relativedelta are by
+ default converted as MonthDayNanoIntervalArray. relativedelta leapday's
+ are ignored as are all absolute fields on both objects. datetime.timedelta
+ can also be converted to MonthDayNanoIntervalArray but require passing
+ MonthDayNanoIntervalType explicitly.
Review comment:
```suggestion
can also be converted to MonthDayNanoIntervalArray but this requires
passing MonthDayNanoIntervalType explicitly.
```
##########
File path: cpp/src/arrow/python/datetime.cc
##########
@@ -71,6 +74,26 @@ bool MatchFixedOffset(const std::string& tz,
util::string_view* sign,
return iter == (tz.data() + tz.size());
}
+static PyTypeObject MonthDayNanoTupleType = {};
+
+constexpr char* NonConst(const char* st) {
+ // Hack for python versions < 3.7 where members of PyStruct members
+ // where non-const (C++ doesn't like assigning string literals to these
types)
+ return const_cast<char*>(st);
Review comment:
Do we still support python versions < 3.7? I thought we stopped
shipping binary wheels for these versions but maybe we still support building
from source.
##########
File path: python/pyarrow/array.pxi
##########
@@ -163,6 +163,12 @@ def array(object obj, type=None, mask=None, size=None,
from_pandas=None,
representation). Timezone-naive data will be implicitly interpreted as
UTC.
+ Pandas's DateOffsets and dateutil.relativedelta.relativedelta are by
+ default converted as MonthDayNanoIntervalArray. relativedelta leapday's
Review comment:
```suggestion
default converted as MonthDayNanoIntervalArray. relativedelta leapdays
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]