jorisvandenbossche commented on a change in pull request #11302:
URL: https://github.com/apache/arrow/pull/11302#discussion_r723034268



##########
File path: python/pyarrow/scalar.pxi
##########
@@ -514,6 +514,32 @@ cdef class DurationScalar(Scalar):
             return datetime.timedelta(microseconds=sp.value // 1000)
 
 
+cdef class MonthDayNanoIntervalScalar(Scalar):
+    """
+    Concrete class for month, day, nanosecond scalars.
+    """
+
+    @property
+    def value(self):
+        """
+        Returns this value pyarrow.MonthDayNanoTuple.
+        """
+        cdef PyObject* val
+        val = GetResultValue(ARROW_TO_PYTHON.ToPrimitive(
+            (deref(self.wrapped.get()))))
+        return PyObject_to_object(val)
+
+    def as_py(self):
+        """
+        Return this value as a Pandas DateOffset instance if Pandas is present
+        otherwise as a named tuple containing months days and nanoseconds.

Review comment:
       Yes, I also agree returning a consistent type here is best (for 
Timestamp there is the complication of datetime.datetime not supporting 
nanoseconds ..). As Weston mentions, we can see later if we want to add some 
option to get a more pandas native object.




-- 
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]


Reply via email to