palexis3 commited on
Commit
3151e90
·
1 Parent(s): c37c62e

Add more experimentation code

Browse files
app/api/routers/file_upload.py CHANGED
@@ -75,7 +75,7 @@ async def create_file(input_file: UploadFile, db: AsyncSession = Depends(get_db_
75
  new_csv_file.close()
76
  csv_file.close()
77
 
78
- df = pd.read_csv(new_output_csv_file_path, names=['transaction_date', 'name_description', 'type', 'amount'], header=0, dtype=str, encoding='utf-8')
79
  # df = df.reindex(columns=['transaction_date', 'name_description', 'type', 'amount'])
80
  # transaction_date_index = df.columns.get_loc('transaction_date')
81
  result["output"] = df
 
75
  new_csv_file.close()
76
  csv_file.close()
77
 
78
+ df = pd.read_csv(new_output_csv_file_path, names=['transaction_date', 'name_description', 'type', 'amount'], header=0, dtype=str, encoding='utf-8', engine='python')
79
  # df = df.reindex(columns=['transaction_date', 'name_description', 'type', 'amount'])
80
  # transaction_date_index = df.columns.get_loc('transaction_date')
81
  result["output"] = df
app/categorization/categorizer_list.py CHANGED
@@ -89,10 +89,7 @@ async def categorize_list(df: pd.DataFrame) -> pd.DataFrame:
89
  # Update the category for uncategorized transactions based on the language model results
90
  if not categorized_descriptions.empty:
91
  # temp_df['category'] = temp_df['name_description'].map(categorized_descriptions.set_index('name_description')['category'])
92
- temp_df['name_description'] = temp_df['name_description'].astype("string")
93
- to_check = ['Amazon', 'Burger King']
94
- mask = temp_df['name_description'].isin(to_check)
95
- print(f"\ncategorize_list categorized_description not empty \nname_description: {temp_df['name_description']}\n mask: \n{temp_df[mask]}\n")
96
 
97
  # df['category'] = df['category'].fillna(
98
  # df['name_description'].map(
 
89
  # Update the category for uncategorized transactions based on the language model results
90
  if not categorized_descriptions.empty:
91
  # temp_df['category'] = temp_df['name_description'].map(categorized_descriptions.set_index('name_description')['category'])
92
+ print(f"\ncategorize_list current dataframe:\n {temp_df}\n")
 
 
 
93
 
94
  # df['category'] = df['category'].fillna(
95
  # df['name_description'].map(