Jan Mühlnikel
show
e22c7b1
raw
history blame
No virus
730 Bytes
import pandas as pd
from functions.semantic_search import search
def contains_code(crs_codes, code_list):
codes = str(crs_codes).split(';')
return any(code in code_list for code in codes)
def filter_projects(df, country_code_list, orga_code_list):
# FILTER COUNTRY
if country_code_list != []:
country_filtered_df = pd.DataFrame()
for c in country_code_list:
c_df = df[df["country"].str.contains(c, na=False)]
country_filtered_df = pd.concat([country_filtered_df, c_df], ignore_index=False)
df = country_filtered_df
# FILTER ORGANIZATION
if orga_code_list != []:
df = df[df['orga_abbreviation'].isin(orga_code_list)]
return df