I have a dataframe that I want to edit with ipydatagrid. I am validating this dataframe against some complex mechanism implemented in Python.
I want to change the background_color to indicate the validation status of each cell (green = validation succeeded, red = validation failed).
My custom validation mechanism returns a pandas DataFrame of same shape as the one passed to the DataGrid but with bool values indicating the validation status of each cell.
I want to be able to do something like this:
renderer = TextRenderer(
background_color=Expr("'green' if df_validation.iloc[cell.row][cell.column] else 'red'")
)
I understand that this currently doesn't work. I wonder if there is a way to get this to work.
Catching changes to the DataGrid with on_cell_change and rerunning my custom validation should work just fine.
However, new features that would be needed:
- A way to pass another dataframe to
Expr (to operate on instead of only cell.metadata.data). ⇒ Is there perhaps a way to just add stuff to metadata?
- Tell DataGrid to update the display of the changed cells. ⇒ Worst case this could be done by custom calls to
grid.set_cell_value.
Any chance that this could be implemented? If so, how? Thank you so much in advance!
I have a dataframe that I want to edit with
ipydatagrid. I am validating this dataframe against some complex mechanism implemented in Python.I want to change the
background_colorto indicate the validation status of each cell (green = validation succeeded, red = validation failed).My custom validation mechanism returns a pandas DataFrame of same shape as the one passed to the DataGrid but with bool values indicating the validation status of each cell.
I want to be able to do something like this:
I understand that this currently doesn't work. I wonder if there is a way to get this to work.
Catching changes to the DataGrid with
on_cell_changeand rerunning my custom validation should work just fine.However, new features that would be needed:
Expr(to operate on instead of onlycell.metadata.data). ⇒ Is there perhaps a way to just add stuff tometadata?grid.set_cell_value.Any chance that this could be implemented? If so, how? Thank you so much in advance!