Update dataframe.py
#10
by
SR05
- opened
- dataframe.py +6 -2
dataframe.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import pandas as pd
|
2 |
import streamlit as st
|
3 |
|
|
|
4 |
def prepare_dataframe(file):
|
5 |
try:
|
6 |
# Read the .ods file into a DataFrame
|
@@ -18,9 +19,12 @@ def prepare_dataframe(file):
|
|
18 |
df = df.iloc[idx + 1:] # Skip the header row
|
19 |
break
|
20 |
|
21 |
-
# Reset the index and
|
22 |
df.reset_index(drop=True, inplace=True)
|
23 |
-
df['Application Number'] = df['Application Number'].astype(str).str.strip()
|
|
|
|
|
|
|
24 |
|
25 |
return df
|
26 |
except Exception as e:
|
|
|
1 |
import pandas as pd
|
2 |
import streamlit as st
|
3 |
|
4 |
+
@st.cache_data
|
5 |
def prepare_dataframe(file):
|
6 |
try:
|
7 |
# Read the .ods file into a DataFrame
|
|
|
19 |
df = df.iloc[idx + 1:] # Skip the header row
|
20 |
break
|
21 |
|
22 |
+
# Reset the index and preprocess application numbers
|
23 |
df.reset_index(drop=True, inplace=True)
|
24 |
+
df['Application Number'] = df['Application Number'].astype(str).str.strip().astype(int)
|
25 |
+
|
26 |
+
# Sort the DataFrame by application number for faster search
|
27 |
+
df = df.sort_values(by='Application Number').reset_index(drop=True)
|
28 |
|
29 |
return df
|
30 |
except Exception as e:
|