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

Serialise NumPy arrays as any other array #394

Closed vthemelis closed 1 year ago

vthemelis commented 1 year ago

Signed-off-by: Vasilis Themelis vdthemelis@gmail.com

Fixes #393

Allow showing NumPy arrays as normal arrays in the grid. There is no distinction made between normal arrays and NumPy arrays once they are serialised but I assume that this is fine as there is not difference between normal floats and NumPy floats either (say).

Added a small unit test to assert that no exception is thrown when initialising a DataGrid object out of a DataFrame that includes np.array objects of various shapes.

Also:

I also noticed that ipydatagrid flattens arrays before showing them on the grid. I might change that on a separate PR.

vthemelis commented 1 year ago

@martinRenou, does this look okay to merge now?

vthemelis commented 1 year ago

@martinRenou , thanks for looking into this again. It looks like the lint step of the build is broken for some reason. I opened and issue for this (https://github.com/bloomberg/ipydatagrid/issues/402). The failure doesn't seem relevant to this PR.

Is it okay if I merge this PR in the meantime or shall we fix the build first?