You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "danepitkin (via GitHub)" <gi...@apache.org> on 2023/04/20 15:53:40 UTC

[GitHub] [arrow] danepitkin commented on a diff in pull request #34658: GH-21761: [Python] accept pyarrow values / scalars in constructor functions ?

danepitkin commented on code in PR #34658:
URL: https://github.com/apache/arrow/pull/34658#discussion_r1172794081


##########
python/pyarrow/array.pxi:
##########
@@ -318,11 +318,29 @@ def array(object obj, type=None, mask=None, size=None, from_pandas=None,
             if pandas_api.have_pandas:
                 values, type = pandas_api.compat.get_datetimetz_type(
                     values, obj.dtype, type)
-            result = _ndarray_to_array(values, mask, type, c_from_pandas, safe,
-                                       pool)
+            try:
+                result = _ndarray_to_array(values, mask, type, c_from_pandas, safe,
+                                           pool)
+            except ArrowInvalid as err:
+                if "Scalar" in str(err):

Review Comment:
   Relying on a substring within the error message seems a bit hacky. Is there any other way to check by chance?



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org