Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
More helpful error message with missing columns
Browse files- gui/app.py +19 -4
gui/app.py
CHANGED
@@ -50,13 +50,19 @@ def greet(
|
|
50 |
empty_df,
|
51 |
"The file has only one column!",
|
52 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
if len(df) > 1000 and not force_run:
|
54 |
return (
|
55 |
empty_df,
|
56 |
"You have uploaded a file with more than 2000 rows. "
|
57 |
"This will take very long to run. "
|
58 |
"Please upload a subsample of the data, "
|
59 |
-
"or check the box 'Ignore Warnings'."
|
60 |
)
|
61 |
|
62 |
binary_operators = str(binary_operators).replace("'", '"')
|
@@ -102,15 +108,24 @@ def main():
|
|
102 |
default=["+", "-", "*", "/"],
|
103 |
),
|
104 |
gr.inputs.CheckboxGroup(
|
105 |
-
choices=[
|
106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
label="Unary Operators",
|
108 |
default=[],
|
109 |
),
|
110 |
gr.inputs.Checkbox(
|
111 |
default=False,
|
112 |
label="Ignore Warnings",
|
113 |
-
)
|
114 |
],
|
115 |
outputs=[
|
116 |
"dataframe",
|
|
|
50 |
empty_df,
|
51 |
"The file has only one column!",
|
52 |
)
|
53 |
+
if col_to_fit not in df.columns:
|
54 |
+
return (
|
55 |
+
empty_df,
|
56 |
+
f"The column to predict, {col_to_fit}, is not in the file!"
|
57 |
+
f"I found {df.columns}.",
|
58 |
+
)
|
59 |
if len(df) > 1000 and not force_run:
|
60 |
return (
|
61 |
empty_df,
|
62 |
"You have uploaded a file with more than 2000 rows. "
|
63 |
"This will take very long to run. "
|
64 |
"Please upload a subsample of the data, "
|
65 |
+
"or check the box 'Ignore Warnings'.",
|
66 |
)
|
67 |
|
68 |
binary_operators = str(binary_operators).replace("'", '"')
|
|
|
108 |
default=["+", "-", "*", "/"],
|
109 |
),
|
110 |
gr.inputs.CheckboxGroup(
|
111 |
+
choices=[
|
112 |
+
"sin",
|
113 |
+
"cos",
|
114 |
+
"exp",
|
115 |
+
"log",
|
116 |
+
"square",
|
117 |
+
"cube",
|
118 |
+
"sqrt",
|
119 |
+
"abs",
|
120 |
+
"tan",
|
121 |
+
],
|
122 |
label="Unary Operators",
|
123 |
default=[],
|
124 |
),
|
125 |
gr.inputs.Checkbox(
|
126 |
default=False,
|
127 |
label="Ignore Warnings",
|
128 |
+
),
|
129 |
],
|
130 |
outputs=[
|
131 |
"dataframe",
|