File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed
packages/python/plotly/plotly/express Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -1858,17 +1858,20 @@ def _check_dataframe_all_leaves(df: nw.DataFrame) -> None:
18581858 null_mask = nw .any_horizontal (nw .all ())
18591859 ).get_column ("null_mask" )
18601860
1861- for row_idx , row in zip (
1862- null_indices_mask , null_mask .filter (null_indices_mask ).iter_rows ()
1863- ):
1864-
1865- i = row .index (True )
1866-
1867- if not all (row [i :]):
1868- raise ValueError (
1869- "None entries cannot have not-None children" ,
1870- df_sorted .row (row_idx ),
1861+ null_mask_filtered = null_mask .filter (null_indices_mask )
1862+ if not null_mask_filtered .is_empty ():
1863+ for col_idx in range (1 , null_mask_filtered .shape [1 ]):
1864+ # For each row, if a True value is encountered, then check that
1865+ # all values in subsequent columns are also True
1866+ null_entries_with_non_null_children = (
1867+ ~ null_mask_filtered [:, col_idx ] & null_mask_filtered [:, col_idx - 1 ]
18711868 )
1869+ if nw .to_py_scalar (null_entries_with_non_null_children .any ()):
1870+ row_idx = null_entries_with_non_null_children .to_list ().index (True )
1871+ raise ValueError (
1872+ "None entries cannot have not-None children" ,
1873+ df_sorted .row (row_idx ),
1874+ )
18721875
18731876 fill_series = nw .new_series (
18741877 name = "fill_value" ,
You can’t perform that action at this time.
0 commit comments