nastasiasnk commited on
Commit
0557b78
1 Parent(s): a25db2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -97,7 +97,8 @@ else:
97
  df_lu_filtered = df_lu[lu_columns].loc[mask_connected]
98
  df_lu_filtered.columns = [col.replace('lu+', '') for col in df_lu_filtered.columns]
99
  df_lu_filtered.columns = [col.replace('ASSETS+', '') for col in df_lu_filtered.columns]
100
-
 
101
  df_lu_filtered = df_lu_filtered.apply(pd.to_numeric, errors='coerce')
102
  df_lu_filtered = df_lu_filtered.astype(int)
103
  df_lu_filtered = df_lu_filtered.T.groupby(level=0).sum().T
@@ -126,10 +127,12 @@ def test(input_json):
126
 
127
  dfLanduses = pd.DataFrame(landuses).T
128
  dfLanduses = dfLanduses.apply(pd.to_numeric, errors='coerce')
 
129
  dfLanduses = dfLanduses.round(0).astype(int)
130
 
131
  dfMatrix = pd.DataFrame(matrix).T
132
  dfMatrix = dfMatrix.apply(pd.to_numeric, errors='coerce')
 
133
  dfMatrix = dfMatrix.round(0).astype(int)
134
  else:
135
  dfLanduses = df_lu_filtered.copy()
 
97
  df_lu_filtered = df_lu[lu_columns].loc[mask_connected]
98
  df_lu_filtered.columns = [col.replace('lu+', '') for col in df_lu_filtered.columns]
99
  df_lu_filtered.columns = [col.replace('ASSETS+', '') for col in df_lu_filtered.columns]
100
+
101
+ df_lu_filtered = df_lu_filtered.replace([np.inf, -np.inf], 10000).fillna(0)
102
  df_lu_filtered = df_lu_filtered.apply(pd.to_numeric, errors='coerce')
103
  df_lu_filtered = df_lu_filtered.astype(int)
104
  df_lu_filtered = df_lu_filtered.T.groupby(level=0).sum().T
 
127
 
128
  dfLanduses = pd.DataFrame(landuses).T
129
  dfLanduses = dfLanduses.apply(pd.to_numeric, errors='coerce')
130
+ dfLanduses = dfLanduses.replace([np.inf, -np.inf], 0).fillna(0)
131
  dfLanduses = dfLanduses.round(0).astype(int)
132
 
133
  dfMatrix = pd.DataFrame(matrix).T
134
  dfMatrix = dfMatrix.apply(pd.to_numeric, errors='coerce')
135
+ dfMatrix = dfMatrix.replace([np.inf, -np.inf], 10000).fillna(0)
136
  dfMatrix = dfMatrix.round(0).astype(int)
137
  else:
138
  dfLanduses = df_lu_filtered.copy()