Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -111,13 +111,18 @@ if st.session_state.processed:
|
|
| 111 |
selected_table_index = table_options.index(selected_table_option) - 1 # Adjust for "None"
|
| 112 |
selected_table_df = st.session_state.tables[selected_table_index]
|
| 113 |
|
| 114 |
-
|
|
|
|
| 115 |
for col in default_columns:
|
| 116 |
-
|
|
|
|
| 117 |
|
| 118 |
# Move default columns to the left
|
| 119 |
-
|
| 120 |
-
|
|
|
|
|
|
|
|
|
|
| 121 |
if not st.session_state.kv_df.empty:
|
| 122 |
# Allow the user to select multiple columns using checkboxes
|
| 123 |
first_row_values = st.session_state.kv_df.iloc[0].values
|
|
|
|
| 111 |
selected_table_index = table_options.index(selected_table_option) - 1 # Adjust for "None"
|
| 112 |
selected_table_df = st.session_state.tables[selected_table_index]
|
| 113 |
|
| 114 |
+
|
| 115 |
+
# Add default columns to the left side of the table with NaN values initially
|
| 116 |
for col in default_columns:
|
| 117 |
+
if col not in selected_table_df.columns:
|
| 118 |
+
selected_table_df[col] = np.nan
|
| 119 |
|
| 120 |
# Move default columns to the left
|
| 121 |
+
# We include only those columns that exist in the table
|
| 122 |
+
existing_columns = [col for col in default_columns if col in selected_table_df.columns]
|
| 123 |
+
remaining_columns = [col for col in selected_table_df.columns if col not in existing_columns]
|
| 124 |
+
selected_table_df = selected_table_df[[*existing_columns, *remaining_columns]]
|
| 125 |
+
|
| 126 |
if not st.session_state.kv_df.empty:
|
| 127 |
# Allow the user to select multiple columns using checkboxes
|
| 128 |
first_row_values = st.session_state.kv_df.iloc[0].values
|