Spaces:
Sleeping
Sleeping
James McCool
Refactor import statements across multiple files to replace 'fuzzywuzzy' with 'rapidfuzz' for improved performance and consistency in string matching functionality. Additionally, clean up unused imports in app.py and related global functions to enhance code clarity and maintainability.
d9db89f
import streamlit as st | |
import numpy as np | |
import pandas as pd | |
import time | |
from rapidfuzz import process | |
def load_csv(upload): | |
if upload is not None: | |
try: | |
if upload.name.endswith('.csv'): | |
df = pd.read_csv(upload) | |
try: | |
df['Name + ID'] = df['Name'] + ' (' + df['ID'].astype(str) + ')' | |
except: | |
pass | |
else: | |
st.error('Please upload either a CSV or Excel file') | |
return None | |
return df | |
except Exception as e: | |
st.error(f'Error loading file: {str(e)}') | |
return None | |
return None |