nesticot commited on
Commit
11a3ebe
·
verified ·
1 Parent(s): d8defff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -519,9 +519,9 @@ def server(input, output, session):
519
  # Step 2: Format the columns with (value (+diff)) - exclude brackets if diff is 80
520
  df_merge = df_merge.with_columns([
521
  pl.when(pl.col(new + "_diff").eq(10000)) # If diff is 80, no need to include brackets
522
- .then(pl.col(new).round(1).cast(pl.Utf8)+'\n\t') # Just return the new value as string
523
  .otherwise(
524
- pl.col(new).round(1).cast(pl.Utf8) +
525
  "\n(" +
526
  pl.col(new + "_diff").round(1)
527
  .map_elements(lambda x: f"{x:+.1f}%") +
 
519
  # Step 2: Format the columns with (value (+diff)) - exclude brackets if diff is 80
520
  df_merge = df_merge.with_columns([
521
  pl.when(pl.col(new + "_diff").eq(10000)) # If diff is 80, no need to include brackets
522
+ .then(pl.col(new) * 100).round(1).cast(pl.Utf8)+'\n\t') # Just return the new value as string
523
  .otherwise(
524
+ (pl.col(new) * 100).round(1).map_elements(lambda x: f"{x:.1f}%").cast(pl.Utf8) +
525
  "\n(" +
526
  pl.col(new + "_diff").round(1)
527
  .map_elements(lambda x: f"{x:+.1f}%") +