From 059e53a39f8c46051efba56d0866b25285fd6623 Mon Sep 17 00:00:00 2001
From: John Bodley <4567245+john-bodley@users.noreply.github.com>
Date: Wed, 26 Oct 2022 15:06:18 -0700
Subject: [PATCH] fix: Crash caused by numpy.vectorize (#21936)

---
 superset/result_set.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/superset/result_set.py b/superset/result_set.py
index b8a5abb6d192f..cf57ddc84af54 100644
--- a/superset/result_set.py
+++ b/superset/result_set.py
@@ -63,8 +63,13 @@ def stringify(obj: Any) -> str:
 
 
 def stringify_values(array: np.ndarray) -> np.ndarray:
-    vstringify = np.vectorize(stringify)
-    return vstringify(array)
+    result = np.copy(array)
+
+    with np.nditer(result, flags=["refs_ok"], op_flags=["readwrite"]) as it:
+        for obj in it:
+            obj[...] = stringify(obj)
+
+    return result
 
 
 def destringify(obj: str) -> Any: