ipydatagrid
ipydatagrid copied to clipboard
Can't filter rows with NaN values
Describe the bug I'm guessing it's because of nan equality issues. When I try to filter by column value and select Nan all rows disappear
PS if you know a way to filter rows without Nan that would also be helpful
I'm having the same problem, to give a little more detail:
import numpy as np
df = pd.DataFrame(
{
"a":[np.nan, "adf", "c"], "b": [np.nan, "b", np.nan]})
gr = DataGrid(df)
gr
same behaviour when applying the transform directly, i.e.
gr.transform(
[
{
"type": "filter",
"operator": "empty",
"columnIndex": 1,
},
]
)
@rtaycher - you can reset the data, i.e.
gr.data = gr.data.dropna(how="all")
its not quite the same though, for my use case this isn't a workable solution.
df = pd.DataFrame(
{"a":[np.nan, "adf", "c"], "b": [np.nan, "b", np.nan]}
)
text_renderer = TextRenderer(text_value=VegaExpr(""" if(isValid(cell.value), cell.value, ' ') """))
display(DataGrid(df, layout={"height": "100px"}))
display(DataGrid(df, default_renderer=text_renderer, layout={"height": "100px"}))
hi @TermeHansen - this is good for appearance.. but doesn't help with filtering...