Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -46,22 +46,28 @@ def get_chunks():
|
|
46 |
|
47 |
projects_df.drop(columns= ['orga_abbreviation', 'client',
|
48 |
'orga_full_name', 'country',
|
49 |
-
'country_flag', 'crs_5_code', 'crs_3_code',
|
50 |
-
'sgd_pred_code'], inplace=True)
|
51 |
print(projects_df.columns)
|
52 |
projects_df['text_size'] = projects_df.apply(lambda x: len((x['title_main'] + x['description_main']).split()), axis=1)
|
53 |
projects_df['chunks'] = projects_df.apply(lambda x:create_chunks(x['title_main'] + x['description_main']),axis=1)
|
54 |
projects_df = projects_df.explode(column=['chunks'], ignore_index=True)
|
|
|
|
|
55 |
|
56 |
#### code for eading the giz_worldwide data
|
57 |
giz_df = pd.read_json('iati_files/data_giz_website.json')
|
58 |
giz_df = giz_df.rename(columns={'content':'project_description'})
|
59 |
-
|
60 |
-
|
61 |
giz_df['text_size'] = giz_df.apply(lambda x: len((x['project_name'] + x['project_description']).split()), axis=1)
|
62 |
giz_df['chunks'] = giz_df.apply(lambda x:create_chunks(x['project_name'] + x['project_description']),axis=1)
|
63 |
giz_df = giz_df.explode(column=['chunks'], ignore_index=True)
|
64 |
print(giz_df.columns)
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
|
66 |
|
67 |
|
|
|
46 |
|
47 |
projects_df.drop(columns= ['orga_abbreviation', 'client',
|
48 |
'orga_full_name', 'country',
|
49 |
+
'country_flag', 'crs_5_code', 'crs_3_code','country_code_list',
|
50 |
+
'sgd_pred_code','crs_5_name', 'crs_3_name', 'sgd_pred_str'], inplace=True)
|
51 |
print(projects_df.columns)
|
52 |
projects_df['text_size'] = projects_df.apply(lambda x: len((x['title_main'] + x['description_main']).split()), axis=1)
|
53 |
projects_df['chunks'] = projects_df.apply(lambda x:create_chunks(x['title_main'] + x['description_main']),axis=1)
|
54 |
projects_df = projects_df.explode(column=['chunks'], ignore_index=True)
|
55 |
+
projects_df['source'] = 'IATI'
|
56 |
+
projects_df.rename(columns = {'iati_id':'id','iati_orga_id':'org'}, inplace=True)
|
57 |
|
58 |
#### code for eading the giz_worldwide data
|
59 |
giz_df = pd.read_json('iati_files/data_giz_website.json')
|
60 |
giz_df = giz_df.rename(columns={'content':'project_description'})
|
|
|
|
|
61 |
giz_df['text_size'] = giz_df.apply(lambda x: len((x['project_name'] + x['project_description']).split()), axis=1)
|
62 |
giz_df['chunks'] = giz_df.apply(lambda x:create_chunks(x['project_name'] + x['project_description']),axis=1)
|
63 |
giz_df = giz_df.explode(column=['chunks'], ignore_index=True)
|
64 |
print(giz_df.columns)
|
65 |
+
giz_df.drop(columns = ['filename', 'url', 'name', 'mail',
|
66 |
+
'language', 'start_year', 'end_year','poli_trager'], inplace=True)
|
67 |
+
giz_df.rename(columns = {'project_name':'title_main','countries':'country_name',
|
68 |
+
'client':'org','project_description':'description_main'}, inplace=True)
|
69 |
+
df = pd.concat([projects_df,giz_df],ignore_index=True)
|
70 |
+
print(df.columns)
|
71 |
|
72 |
|
73 |
|