Spaces:
Build error
Build error
Upload app.py
Browse files46 unmodified lines4748495051505152535446 unmodified lines)
# Ensure strings, remove unicode issues
treemap_data['GenLU'] = treemap_data['GenLU'].astype(str).str.encode('ascii', 'ignore').str.decode('utf-8')
treemap_data['crop_name'] = treemap_data['crop_name'].astype(str).str.encode('ascii', 'ignore').str.decode('utf-8')
treemap_data['GenLU'] = treemap_data['GenLU'].astype(str).str.replace(r'[^a-zA-Z0-9\s/]', '', regex=True)
treemap_data['crop_name'] = treemap_data['crop_name'].astype(str).str.replace(r'[^a-zA-Z0-9\s/]', '', regex=True)
# Group by hierarchy and sum field counts
treemap_data = (app.py+2-2