Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -615,7 +615,7 @@ def process(files,button):
|
|
| 615 |
|
| 616 |
old_cols = df.columns
|
| 617 |
old_olds = list(old_cols)
|
| 618 |
-
sums_old = ['{:,.
|
| 619 |
print("Before columns")
|
| 620 |
print(old_olds)
|
| 621 |
|
|
@@ -658,6 +658,9 @@ def process(files,button):
|
|
| 658 |
df = pd.concat([df, temp], ignore_index=True)
|
| 659 |
column_mapping = dict(zip(columns, finalnames))
|
| 660 |
df = df.rename(columns=column_mapping)
|
|
|
|
|
|
|
|
|
|
| 661 |
|
| 662 |
#display(df)
|
| 663 |
name = os.path.basename(name)
|
|
@@ -671,7 +674,8 @@ def process(files,button):
|
|
| 671 |
sheet_data[name] = {
|
| 672 |
"Before columns": [old_olds],
|
| 673 |
'Sum':[sums_old,None,True],
|
| 674 |
-
"After columns": [
|
|
|
|
| 675 |
'Filled quarters':[filled_warn,None],
|
| 676 |
"Warnings": sheetwarnings
|
| 677 |
}
|
|
|
|
| 615 |
|
| 616 |
old_cols = df.columns
|
| 617 |
old_olds = list(old_cols)
|
| 618 |
+
sums_old = ['{:,.2f}'.format(df[col].sum()) if np.issubdtype(df[col].dtype, np.number) else "-" for col in old_cols]
|
| 619 |
print("Before columns")
|
| 620 |
print(old_olds)
|
| 621 |
|
|
|
|
| 658 |
df = pd.concat([df, temp], ignore_index=True)
|
| 659 |
column_mapping = dict(zip(columns, finalnames))
|
| 660 |
df = df.rename(columns=column_mapping)
|
| 661 |
+
# sum new
|
| 662 |
+
ncols = df.columns
|
| 663 |
+
sums_new = ['{:,.2f}'.format(df[ncol].sum()) if np.issubdtype(df[ncol].dtype, np.number) else "-" for col in old_cols]
|
| 664 |
|
| 665 |
#display(df)
|
| 666 |
name = os.path.basename(name)
|
|
|
|
| 674 |
sheet_data[name] = {
|
| 675 |
"Before columns": [old_olds],
|
| 676 |
'Sum':[sums_old,None,True],
|
| 677 |
+
"After columns": [ncols, '00FF00'],
|
| 678 |
+
'Sum':[sums_new,None,True],
|
| 679 |
'Filled quarters':[filled_warn,None],
|
| 680 |
"Warnings": sheetwarnings
|
| 681 |
}
|