Spaces:
Sleeping
Sleeping
Commit
·
d74d2ee
1
Parent(s):
cb46124
Update app.py
Browse files
app.py
CHANGED
@@ -98,11 +98,11 @@ df_hail_cut["Lon_address"] = lon
|
|
98 |
df_hail_cut['Miles to Hail'] = [
|
99 |
distance(i) for i in df_hail_cut[['LAT', 'LON', 'Lat_address', 'Lon_address']].values]
|
100 |
df_hail_cut['MAXSIZE'] = df_hail_cut['MAXSIZE'].round(1)
|
101 |
-
|
102 |
df_hail_cut = df_hail_cut.query("`Miles to Hail`<10")
|
103 |
df_hail_cut['Category'] = np.where(df_hail_cut['Miles to Hail'] < 1, "Within 1 Mile",
|
104 |
np.where(df_hail_cut['Miles to Hail'] < 3, "Within 3 Miles",
|
105 |
-
|
|
|
106 |
|
107 |
df_hail_cut_group = pd.pivot_table(df_hail_cut, index='Date_utc',
|
108 |
columns='Category',
|
@@ -110,7 +110,7 @@ df_hail_cut_group = pd.pivot_table(df_hail_cut, index='Date_utc',
|
|
110 |
aggfunc='max')
|
111 |
|
112 |
cols = df_hail_cut_group.columns
|
113 |
-
cols_focus = [ "Within 1 Mile",
|
114 |
"Within 3 Miles", "Within 10 Miles"]
|
115 |
|
116 |
missing_cols = set(cols_focus)-set(cols)
|
@@ -120,14 +120,14 @@ for c in missing_cols:
|
|
120 |
df_hail_cut_group2 = df_hail_cut_group[cols_focus].query(
|
121 |
"`Within 3 Miles`==`Within 3 Miles`")
|
122 |
|
123 |
-
for i in range(
|
124 |
df_hail_cut_group2[cols_focus[i+1]] = np.where(df_hail_cut_group2[cols_focus[i+1]].fillna(0) <
|
125 |
-
df_hail_cut_group2[cols_focus[i]].fillna(
|
126 |
-
0),
|
127 |
df_hail_cut_group2[cols_focus[i]],
|
128 |
df_hail_cut_group2[cols_focus[i+1]])
|
129 |
|
130 |
|
|
|
131 |
df_hail_cut_group2 = df_hail_cut_group2.sort_index(ascending=False)
|
132 |
|
133 |
df_hail_cut_group2.index = pd.to_datetime(
|
|
|
98 |
df_hail_cut['Miles to Hail'] = [
|
99 |
distance(i) for i in df_hail_cut[['LAT', 'LON', 'Lat_address', 'Lon_address']].values]
|
100 |
df_hail_cut['MAXSIZE'] = df_hail_cut['MAXSIZE'].round(1)
|
|
|
101 |
df_hail_cut = df_hail_cut.query("`Miles to Hail`<10")
|
102 |
df_hail_cut['Category'] = np.where(df_hail_cut['Miles to Hail'] < 1, "Within 1 Mile",
|
103 |
np.where(df_hail_cut['Miles to Hail'] < 3, "Within 3 Miles",
|
104 |
+
np.where( df_hail_cut['Miles to Hail'] < 5, "Within 5 Miles",
|
105 |
+
np.where(df_hail_cut['Miles to Hail'] < 10, "Within 10 Miles", 'Other'))))
|
106 |
|
107 |
df_hail_cut_group = pd.pivot_table(df_hail_cut, index='Date_utc',
|
108 |
columns='Category',
|
|
|
110 |
aggfunc='max')
|
111 |
|
112 |
cols = df_hail_cut_group.columns
|
113 |
+
cols_focus = [ "Within 1 Mile","Within 5 Miles",
|
114 |
"Within 3 Miles", "Within 10 Miles"]
|
115 |
|
116 |
missing_cols = set(cols_focus)-set(cols)
|
|
|
120 |
df_hail_cut_group2 = df_hail_cut_group[cols_focus].query(
|
121 |
"`Within 3 Miles`==`Within 3 Miles`")
|
122 |
|
123 |
+
for i in range(len(cols)):
|
124 |
df_hail_cut_group2[cols_focus[i+1]] = np.where(df_hail_cut_group2[cols_focus[i+1]].fillna(0) <
|
125 |
+
df_hail_cut_group2[cols_focus[i]].fillna(0),
|
|
|
126 |
df_hail_cut_group2[cols_focus[i]],
|
127 |
df_hail_cut_group2[cols_focus[i+1]])
|
128 |
|
129 |
|
130 |
+
|
131 |
df_hail_cut_group2 = df_hail_cut_group2.sort_index(ascending=False)
|
132 |
|
133 |
df_hail_cut_group2.index = pd.to_datetime(
|