Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaT-datetime-values break ipydatagrid #522

Open
m-rossi opened this issue Jun 10, 2024 · 0 comments
Open

NaT-datetime-values break ipydatagrid #522

m-rossi opened this issue Jun 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@m-rossi
Copy link

m-rossi commented Jun 10, 2024

Describe the bug
It's me again with some datetime bug. If there is NA-data in a datetime column ipydatagrid crashes.

To Reproduce

import pandas as pd
from ipydatagrid import DataGrid

df = pd.DataFrame({'A': ['2024-01-01', pd.NA]}, dtype='datetime64[ns]')
df

renders as HTML-table like this:
grafik
but if I try to put that df in a Datagrid:

DataGrid(df)

I get this:
grafik

[Open Browser Console for more detailed log - Double click to close this message]
Model class 'DataGridModel' from module 'ipydatagrid' is loaded but can not be instantiated
deserialize@http://localhost:8888/lab/extensions/ipydatagrid/static/787.b52e0074e2cbca59f4b7.js?v=b52e0074e2cbca59f4b7:1:59997
_deserialize_state@http://localhost:8888/lab/extensions/@jupyter-widgets/jupyterlab-manager/static/647.e39f528c8fee8adb9110.js?v=e39f528c8fee8adb9110:1:12381

Expected behavior
To be able to render NaT-datetime-values

Workaround
I have a workaround for anyone who may also have this issue until it is solved:

df['A'] = df['A'].astype(object).fillna('')

Environment (please complete the following information):

  • Operating System and Version: Windows 22H2
  • Browser: Firefox
  • ipydatagrid version: 1.3.2
@martinRenou martinRenou added the bug Something isn't working label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants