h2oai / h2oai/wave

Plot issue when using int64 values

Open
#496 6 comments 0 reactions 0 assignees View on GitHub
feature py
Dominant language
Python
Stars
4.3k
Forks
371
Avg merge
26d 1h
Merged PRs (30d)
1

Description

#### Wave SDK Version, OS

0.10.0

Hit a but while experiment with this code:
```
from h2o_wave import site, data, ui, app, main, Q
import numpy as np

@app('/')
async def serve(q: Q):
age = [10, 10, 20, 30, 40, 20]
unique, counts = np.unique(age, return_counts=True)
rows1 = list(zip(unique, counts))
rows = [(0,1), (2,3)]
q.page['plot1'] = ui.plot_card(
box='1 1 -1 -1',
title='Age Count',
data=data('age count', rows=rows1),
plot=ui.plot([ui.mark(type='interval', x='=age', y='=count', x_min=0, y_min=0,
x_title='Age', y_title='Count', color='#33BBFF')]
))
await q.page.save()
```

If I use rows, the code works fine because the values are int. If I use rows1, the values are of type int64 and it complains about int64 values not being JSON serializable.

`TypeError: Object of type int64 is not JSON serializable`

Should we try to cast to int to avoid hard fails?

cc @lo5 @mturoci

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.