king007 commited on
Commit
985e8ec
·
1 Parent(s): f02edf5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
app.py CHANGED
@@ -379,24 +379,25 @@ def postprocess_dataframes(result_tables):
379
  for idx, table_df in enumerate(result_tables):
380
  result_df = pd.DataFrame()
381
  print("--1")
382
- print(result_df)
383
  print("--2")
384
- print(result_df.to_json(orient="records"))
385
- # for col in table_df.columns:
386
- # if col.lower().startswith("item"):
387
- # result_df["name"] = table_df[col].copy()
388
- # if (
389
- # col.lower().startswith("total")
390
- # or col.lower().startswith("amount")
391
- # or col.lower().startswith("cost")
392
- # ):
393
- # result_df["amount"] = table_df[col].copy()
394
- print("--3")
395
- print(result_df.columns)
396
  if len(result_df.columns) == 0:
397
  result_df["name"] = table_df.iloc[:, 0].copy()
398
  result_df["amount"] = table_df.iloc[:, 1].copy()
399
-
 
 
400
  result_df["cost_code"] = ""
401
  # res["Table" + str(idx)] = result_df.to_json(orient="records")
402
  res=result_df.to_json(orient="records")
 
379
  for idx, table_df in enumerate(result_tables):
380
  result_df = pd.DataFrame()
381
  print("--1")
382
+ print(table_df)
383
  print("--2")
384
+ print(table_df.to_json(orient="records"))
385
+ for col in table_df.columns:
386
+ if col.lower().startswith("item"):
387
+ result_df["name"] = table_df[col].copy()
388
+ if (
389
+ col.lower().startswith("total")
390
+ or col.lower().startswith("amount")
391
+ or col.lower().startswith("cost")
392
+ ):
393
+ result_df["amount"] = table_df[col].copy()
394
+
 
395
  if len(result_df.columns) == 0:
396
  result_df["name"] = table_df.iloc[:, 0].copy()
397
  result_df["amount"] = table_df.iloc[:, 1].copy()
398
+ print("--3")
399
+ print(result_df.columns)
400
+
401
  result_df["cost_code"] = ""
402
  # res["Table" + str(idx)] = result_df.to_json(orient="records")
403
  res=result_df.to_json(orient="records")