jupyter-widgets / ipydatagrid

Fast Datagrid widget for the Jupyter Notebook and JupyterLab
BSD 3-Clause "New" or "Revised" License
579 stars 51 forks source link

datetime and Decimal objects get "Can't clean for JSON" message #336

Closed JohnOmernik closed 2 years ago

JohnOmernik commented 2 years ago

Describe the bug Similar to the pd.NA bug #257 datatypes like datetime and Decimal objects produce and error on render. Perhaps we should just to do the str repr?

To Reproduce


import datetime
import ipydatagrid
from decimal import Decimal
import pandas as pd
mydf = pd.DataFrame({"text_col": ['a', 'b', pd.NA, Decimal(0.00), datetime.date(2022, 8, 19)]})

mydg = ipydatagrid.DataGrid(mydf)

**Expected behavior**
Ideally if there is a type of data it doesn't understand, force it to string and show it as such (or at least an option to do that)
ibdafna commented 2 years ago

Hello @JohnOmernik and welcome to the ipydatagrid community! Thanks for reporting the error - I will get that fixed.