shrudhit commited on
Commit
2d40501
·
verified ·
1 Parent(s): d99c57a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -2,15 +2,19 @@ import gradio as gr
2
  import pandas as pd
3
 
4
  def process_file(file):
5
- df = pd.read_excel(file.name, header=None)
6
 
7
  # delete first 4 rows
8
  df = df.iloc[4:].reset_index(drop=True)
9
 
10
- # make sure columns up to J exist
11
  while df.shape[1] < 10:
12
  df[df.shape[1]] = ""
13
 
 
 
 
 
14
  # column H = I - J
15
  df.iloc[:,7] = df.iloc[:,8] - df.iloc[:,9]
16
 
 
2
  import pandas as pd
3
 
4
  def process_file(file):
5
+ df = pd.read_excel(file, header=None)
6
 
7
  # delete first 4 rows
8
  df = df.iloc[4:].reset_index(drop=True)
9
 
10
+ # ensure columns up to J exist
11
  while df.shape[1] < 10:
12
  df[df.shape[1]] = ""
13
 
14
+ # convert to numbers
15
+ df.iloc[:,8] = pd.to_numeric(df.iloc[:,8], errors="coerce")
16
+ df.iloc[:,9] = pd.to_numeric(df.iloc[:,9], errors="coerce")
17
+
18
  # column H = I - J
19
  df.iloc[:,7] = df.iloc[:,8] - df.iloc[:,9]
20