Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Jan Mühlnikel
commited on
Commit
•
57a5237
1
Parent(s):
b4bc26b
added filter function for projects
Browse files- functions/filter_projects.py +13 -0
functions/filter_projects.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pandas as pd
|
2 |
+
|
3 |
+
|
4 |
+
def contains_code(crs_codes, code_list):
|
5 |
+
codes = str(crs_codes).split(';')
|
6 |
+
return any(code in code_list for code in codes)
|
7 |
+
|
8 |
+
def filter_projects(df, crs3_list):
|
9 |
+
filtered_crs_df = df[df['crs_3_code'].apply(lambda x: contains_code(x, crs3_list))]
|
10 |
+
|
11 |
+
return filtered_crs_df
|
12 |
+
|
13 |
+
|