Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -420,8 +420,11 @@ def main():
|
|
| 420 |
worksheet.insert_chart('E5', chart)
|
| 421 |
|
| 422 |
elif chart_type == "Bar Chart":
|
| 423 |
-
#
|
| 424 |
-
df_triplet[frequency_col] = df_triplet[frequency_col].
|
|
|
|
|
|
|
|
|
|
| 425 |
|
| 426 |
# Sort the DataFrame based on the numeric percentage values
|
| 427 |
df_triplet = df_triplet.sort_values(by=frequency_col)
|
|
|
|
| 420 |
worksheet.insert_chart('E5', chart)
|
| 421 |
|
| 422 |
elif chart_type == "Bar Chart":
|
| 423 |
+
# Ensure all values in frequency_col are strings before processing
|
| 424 |
+
df_triplet[frequency_col] = df_triplet[frequency_col].astype(str)
|
| 425 |
+
|
| 426 |
+
# Remove the percentage sign and convert to numeric, handling non-convertible values (e.g., NaN)
|
| 427 |
+
df_triplet[frequency_col] = pd.to_numeric(df_triplet[frequency_col].str.rstrip('%'), errors='coerce')
|
| 428 |
|
| 429 |
# Sort the DataFrame based on the numeric percentage values
|
| 430 |
df_triplet = df_triplet.sort_values(by=frequency_col)
|