|
import pandas as pd |
|
import streamlit as st |
|
|
|
def process_dataframe(ods_file): |
|
try: |
|
|
|
df = pd.read_excel(ods_file, engine='odf') |
|
|
|
|
|
df.drop(columns=["Unnamed: 0", "Unnamed: 1"], inplace=True, errors='ignore') |
|
df.dropna(how='all', inplace=True) |
|
df.reset_index(drop=True, inplace=True) |
|
|
|
|
|
for idx, row in df.iterrows(): |
|
if row['Unnamed: 2'] == 'Application Number' and row['Unnamed: 3'] == 'Decision': |
|
df.columns = ['Application Number', 'Decision'] |
|
df = df.iloc[idx + 1:] |
|
break |
|
|
|
|
|
df.reset_index(drop=True, inplace=True) |
|
df['Application Number'] = df['Application Number'].astype(str) |
|
return df |
|
except Exception as e: |
|
st.error(f"Error processing the data: {e}") |
|
return pd.DataFrame() |
|
|