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



##########
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:
       I kind of agree, I modeled this after  
[Timestamps](https://github.com/apache/arrow/blob/master/python/pyarrow/scalar.pxi#L382)
  which also changes behavior.  Happy to simplify this though if that is 
desired (along with corresponding to_pylist()) logic.




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