You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/10/25 18:14:52 UTC

[GitHub] [superset] john-bodley commented on a diff in pull request #21936: fix: Crash caused by numpy.vectorize

john-bodley commented on code in PR #21936:
URL: https://github.com/apache/superset/pull/21936#discussion_r1004824179


##########
superset/result_set.py:
##########
@@ -63,8 +63,12 @@ def stringify(obj: Any) -> str:
 
 
 def stringify_values(array: np.ndarray) -> np.ndarray:
-    vstringify = np.vectorize(stringify)
-    return vstringify(array)
+    result = np.copy(array)
+
+    for obj in np.nditer(result, flags=["refs_ok"], op_flags=["readwrite"]):
+        obj[...] = stringify(obj)

Review Comment:
   I've never come across the `...` in the context of Numpy before, but this logic was lifted from their [official documentation](https://numpy.org/doc/stable/reference/arrays.nditer.html#modifying-array-values) sans the `with` block.



-- 
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: notifications-unsubscribe@superset.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org