Support pandas versions < 1.1.0

master
Dan Howe 3 years ago
parent b72c9a2223
commit 4852d8d91f

@ -38,13 +38,13 @@ df = pd.read_excel('IPCC AR6.xlsx', index_col=[0, 1, 2, 3, 4])
df = df.sort_index() df = df.sort_index()
dff = df.loc[838, 'total', 'medium', 'ssp585'].T dff = df.loc[838, 'total', 'medium', 'ssp585'].T
dff.index.name = 'year' dff.index.name = 'year'
percentiles = dff.columns.to_numpy() / 100 percentiles = dff.columns.values / 100
# Make SLR relative to 2020 level (at the 50th percentile) # Make SLR relative to 2020 level (at the 50th percentile)
dff -= dff.loc[2020, 50] dff -= dff.loc[2020, 50]
for i, row in dff.iterrows(): for i, row in dff.iterrows():
values = row.to_numpy() values = row.values
# Fit normal distribution # Fit normal distribution
loc, scale = optimize.curve_fit(norm_cdf, values, percentiles)[0] loc, scale = optimize.curve_fit(norm_cdf, values, percentiles)[0]

Loading…
Cancel
Save