Update app.py
Browse files
app.py
CHANGED
@@ -532,7 +532,13 @@ def server(input, output, session):
|
|
532 |
# Step 2: Format the columns with (value (+diff)) - exclude brackets if diff is 80
|
533 |
df_merge = df_merge.with_columns([
|
534 |
pl.when(pl.col(new + "_diff").eq(10000)) # If diff is 80, no need to include brackets
|
535 |
-
.then(
|
|
|
|
|
|
|
|
|
|
|
|
|
536 |
.otherwise(
|
537 |
(pl.col(new)*100).round(1).map_elements(lambda x: f"{x:.1f}%").cast(pl.Utf8) +
|
538 |
"\n(" +
|
|
|
532 |
# Step 2: Format the columns with (value (+diff)) - exclude brackets if diff is 80
|
533 |
df_merge = df_merge.with_columns([
|
534 |
pl.when(pl.col(new + "_diff").eq(10000)) # If diff is 80, no need to include brackets
|
535 |
+
.then(
|
536 |
+
(pl.col(new)*100).round(1).map_elements(lambda x: f"{x:.1f}%").cast(pl.Utf8) +
|
537 |
+
"\n(" +
|
538 |
+
(pl.col(new)*100).round(1)
|
539 |
+
.map_elements(lambda x: f"{x:+.1f}%") +
|
540 |
+
")"
|
541 |
+
)
|
542 |
.otherwise(
|
543 |
(pl.col(new)*100).round(1).map_elements(lambda x: f"{x:.1f}%").cast(pl.Utf8) +
|
544 |
"\n(" +
|