Pārlūkot izejas kodu

Put bool dtype first otherwise bool data were shown in a number control field

Michel Lavoie 2 gadi atpakaļ
vecāks
revīzija
d616f367e7
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3 3
      examples/pandas_dataframe/main.py

+ 3 - 3
examples/pandas_dataframe/main.py

@@ -25,10 +25,10 @@ def home():
                 ui.label(col.capitalize())
                 for r, row in enumerate(df.loc[:, col]):
                     with ui.row().classes("h-8 items-center"):
-                        if is_numeric_dtype(df[col].dtype):
-                            cls = ui.number
-                        elif is_bool_dtype(df[col].dtype):
+                        if is_bool_dtype(df[col].dtype):
                             cls = ui.checkbox
+                        elif is_numeric_dtype(df[col].dtype):
+                            cls = ui.number
                         else:
                             cls = ui.input
                         cls(value=row, on_change=lambda event, r=r, c=c: update(df=df, r=r, c=c, value=event.value))