Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3a5930f

Browse files
committed
Plotly.js doesn't support 64-bit (unsiged)integer typed arrays
1 parent 45d4f7b commit 3a5930f

File tree

1 file changed

+4
-2
lines changed
  • packages/python/plotly/_plotly_utils

1 file changed

+4
-2
lines changed

packages/python/plotly/_plotly_utils/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,17 @@ class NotEncodable(Exception):
235235
def b64_encode_numpy(obj):
236236
# Convert 1D numpy arrays with numeric types to memoryviews with
237237
# datatype and shape metadata.
238-
if obj.dtype.kind in ["u", "i", "f"]:
238+
dtype = obj.dtype
239+
if (dtype.kind in ["u", "i", "f"] and
240+
str(dtype) != "int64" and str(dtype) != "uint64"):
239241
# We have a numpy array that is compatible with JavaScript typed
240242
# arrays
241243
buffer = base64.b64encode(memoryview(
242244
obj.ravel(order="C"))
243245
).decode("utf-8")
244246
return {
245247
"bvals": buffer,
246-
"dtype": str(obj.dtype),
248+
"dtype": str(dtype),
247249
"shape": obj.shape
248250
}
249251
else:

0 commit comments

Comments
 (0)