annikwag commited on
Commit
3114b48
·
verified ·
1 Parent(s): 390ed12

Update appStore/prep_data.py

Browse files
Files changed (1) hide show
  1. appStore/prep_data.py +7 -1
appStore/prep_data.py CHANGED
@@ -88,7 +88,13 @@ def process_giz_worldwide():
88
 
89
  # Create an empty 'url' column as the new dataset has an empty URL
90
  giz_df['url'] = ''
91
-
 
 
 
 
 
 
92
  # Compute text_size based on merged_text and assign full text to the 'chunks' column
93
  giz_df['text_size'] = giz_df['merged_text'].apply(lambda text: len(text.split()) if isinstance(text, str) else 0)
94
 
 
88
 
89
  # Create an empty 'url' column as the new dataset has an empty URL
90
  giz_df['url'] = ''
91
+
92
+ # Convert the CRS value to integer (if the column exists)
93
+ if 'crs_value' in giz_df.columns:
94
+ giz_df['crs_value'] = giz_df['crs_value'].apply(
95
+ lambda x: int(float(x)) if pd.notnull(x) and str(x).strip() != "" else x
96
+ )
97
+
98
  # Compute text_size based on merged_text and assign full text to the 'chunks' column
99
  giz_df['text_size'] = giz_df['merged_text'].apply(lambda text: len(text.split()) if isinstance(text, str) else 0)
100