Figure 3: Intersection as function of dispersion parameters#

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns

from scipy.interpolate import InterpolatedUnivariateSpline
df = pd.read_csv('../../outputs/fig3e_1000sim_summary.csv')
df
Unnamed: 0 Unnamed: 1 error_angle_mean error_angle_median error_angle_25 error_angle_75 error_angle_95 error_angle_std error_angle_S2 error_vgp_scatter ... N n0 kappa_within_site site_lat site_long outlier_rate secular_method kappa_secular ignore_outliers total_simulations
0 0 0 3.771308 3.594938 2.240421 5.035025 7.375312 2.023242 18.312184 2.997391 ... 20 5 30 30 0.0 0.50 G NaN True 1000
1 1 0 1.730438 1.648910 1.104129 2.261568 3.274322 0.869591 3.749846 1.273642 ... 100 1 80 20 0.0 0.34 G NaN vandamme 1000
2 2 0 8.017145 6.780163 4.366665 10.443058 17.805335 5.227918 91.578404 38.481535 ... 100 1 60 40 0.0 0.62 G NaN vandamme 1000
3 3 0 5.956192 4.968238 3.012804 7.761616 14.643731 4.244685 53.475554 27.775155 ... 100 1 70 40 0.0 0.58 G NaN vandamme 1000
4 4 0 2.642335 2.486254 1.598886 3.473907 5.219749 1.425148 9.010949 2.356351 ... 100 1 80 60 0.0 0.30 G NaN vandamme 1000
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
1795 1795 0 2.614553 2.447370 1.594581 3.453479 5.070875 1.374982 8.724571 1.823777 ... 20 5 40 10 0.0 0.30 G NaN True 1000
1796 1796 0 3.008607 2.862543 1.816675 3.980189 5.834281 1.573454 11.524994 1.943311 ... 20 5 70 30 0.0 0.30 G NaN True 1000
1797 1797 0 3.824889 3.575288 2.178672 5.088705 7.684161 2.072258 18.919735 2.600436 ... 20 5 70 40 0.0 0.58 G NaN True 1000
1798 1798 0 5.027593 4.746179 3.024909 6.557026 9.930260 2.625040 32.160635 3.128950 ... 20 5 80 70 0.0 0.54 G NaN True 1000
1799 1799 0 4.391415 3.851872 2.431412 5.755751 9.592751 2.725885 26.707541 14.180027 ... 100 1 40 70 0.0 0.38 G NaN vandamme 1000

1800 rows × 21 columns

Let’s pick just one entry of the array (kappa_within_site and latitude) and see the different performances as a function of outlier rate.

def critical_outlier_rate(df_, kappa_within_site, site_lat):
    
    df_subset = df_[(df_.kappa_within_site==kappa_within_site) & (df_.site_lat==site_lat)]

    df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
    df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
    
    outlier_rate = df1.outlier_rate
    error_1 = df1.error_angle_mean.values
    error_5 = df5.error_angle_mean.values
    error_diff = error_1 - error_5
    
    roots = InterpolatedUnivariateSpline(outlier_rate, error_diff).roots()

    return roots[0]
all_kappa_within_site = sorted(np.unique(df.kappa_within_site))
all_site_lat = sorted(np.unique(df.site_lat))

n_kappa_within_site = len(all_kappa_within_site)
n_site_lat = len(all_site_lat)

Critical_outlier_rate = np.zeros((n_site_lat, n_kappa_within_site))

for i in range(n_site_lat):
    for j in range(n_kappa_within_site):
        _df_critical = pd.DataFrame({"site_lat": [all_site_lat[i]],
                                      "kappa_within_site": [all_kappa_within_site[j]],
                                      "critical": critical_outlier_rate(df, kappa_within_site=all_kappa_within_site[j], site_lat=all_site_lat[i])})
        if i==0 and j==0:
            df_critical = _df_critical
        else:
            df_critical = pd.concat([df_critical, _df_critical], axis=0, ignore_index=True)
        # Critical_outlier_rate[i,j] = critical_outlier_rate(df, kappa_within_site=all_kappa_within_site[j], site_lat=all_site_lat[i])
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
np.round(df_critical.pivot('site_lat', 'kappa_within_site', 'critical'), decimals=2).sort_index(ascending=False)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[5], line 1
----> 1 np.round(df_critical.pivot('site_lat', 'kappa_within_site', 'critical'), decimals=2).sort_index(ascending=False)

TypeError: pivot() takes 1 positional argument but 4 were given
plt.figure(figsize=(10,10))
sns.heatmap(df_critical.pivot('site_lat', 'kappa_within_site', 'critical').sort_index(ascending=False), 
            fmt=".2f",
            square=True, annot=True, linewidths=0.1, 
            vmin=0.35, vmax=0.65, cmap="Greens", alpha=0.8,
            cbar=False,
            cbar_kws = {'location': 'right', "boundaries":np.arange(0.35, 0.65, 0.02), "fraction": 0.04},
            annot_kws={"fontsize": 20, "color":'black'})
            # cmap=sns.color_palette("YlOrBr", as_cmap=True));

plt.ylabel("Site latitude ($\lambda$)", fontsize=20)
plt.xlabel("Kappa within site ($\kappa_w$)", fontsize=20)
plt.yticks(fontsize=18)
plt.xticks(fontsize=18)

plt.savefig("Figure3e.pdf", format="pdf", bbox_inches='tight')
plt.savefig("Figure3e.png", format="png", bbox_inches='tight')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[6], line 2
      1 plt.figure(figsize=(10,10))
----> 2 sns.heatmap(df_critical.pivot('site_lat', 'kappa_within_site', 'critical').sort_index(ascending=False), 
      3             fmt=".2f",
      4             square=True, annot=True, linewidths=0.1, 
      5             vmin=0.35, vmax=0.65, cmap="Greens", alpha=0.8,
      6             cbar=False,
      7             cbar_kws = {'location': 'right', "boundaries":np.arange(0.35, 0.65, 0.02), "fraction": 0.04},
      8             annot_kws={"fontsize": 20, "color":'black'})
      9             # cmap=sns.color_palette("YlOrBr", as_cmap=True));
     11 plt.ylabel("Site latitude ($\lambda$)", fontsize=20)

TypeError: pivot() takes 1 positional argument but 4 were given
<Figure size 1000x1000 with 0 Axes>

Figure 3f#

df = pd.read_csv('../../outputs/fig3f_1000sim_summary.csv')
df = df.rename(columns={'k': 'n0'})
all_kappa_within_site = sorted(np.unique(df.kappa_within_site))
all_site_lat = sorted(np.unique(df.site_lat))

n_kappa_within_site = len(all_kappa_within_site)
n_site_lat = len(all_site_lat)

Critical_outlier_rate = np.zeros((n_site_lat, n_kappa_within_site))

for i in range(n_site_lat):
    for j in range(n_kappa_within_site):
        _df_critical = pd.DataFrame({"site_lat": [all_site_lat[i]],
                                      "kappa_within_site": [all_kappa_within_site[j]],
                                      "critical": critical_outlier_rate(df, kappa_within_site=all_kappa_within_site[j], site_lat=all_site_lat[i])})
        if i==0 and j==0:
            df_critical = _df_critical
        else:
            df_critical = pd.concat([df_critical, _df_critical], axis=0, ignore_index=True)
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:5: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df1 = df_subset[df.n0==1].sort_values(by="outlier_rate")
/tmp/ipykernel_2291/1095253769.py:6: UserWarning: Boolean Series key will be reindexed to match DataFrame index.
  df5 = df_subset[df.n0==5].sort_values(by="outlier_rate")
df_critical.pivot('site_lat', 'kappa_within_site', 'critical')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[9], line 1
----> 1 df_critical.pivot('site_lat', 'kappa_within_site', 'critical')

TypeError: pivot() takes 1 positional argument but 4 were given
plt.figure(figsize=(10,10))
sns.heatmap(df_critical.pivot('site_lat', 'kappa_within_site', 'critical').sort_index(ascending=False), 
            fmt=".2f",
            square=True, annot=True, linewidths=0.1, 
            vmin=0.15, vmax=0.35, cmap="Blues", alpha=0.8,
            cbar=False,
            cbar_kws = {'location': 'right', "boundaries":np.arange(0.15, 0.30, 0.02), "fraction": 0.04},
            annot_kws={"fontsize": 20, "color":'black'})
            # cmap=sns.color_palette("YlOrBr", as_cmap=True));

plt.ylabel("Site latitude ($\lambda$)", fontsize=20)
plt.xlabel("Kappa within site ($\kappa_w$)", fontsize=20)
plt.yticks(fontsize=18)
plt.xticks(fontsize=18)

plt.savefig("Figure3f.pdf", format="pdf", bbox_inches='tight')
plt.savefig("Figure3f.png", format="png", bbox_inches='tight')
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[10], line 2
      1 plt.figure(figsize=(10,10))
----> 2 sns.heatmap(df_critical.pivot('site_lat', 'kappa_within_site', 'critical').sort_index(ascending=False), 
      3             fmt=".2f",
      4             square=True, annot=True, linewidths=0.1, 
      5             vmin=0.15, vmax=0.35, cmap="Blues", alpha=0.8,
      6             cbar=False,
      7             cbar_kws = {'location': 'right', "boundaries":np.arange(0.15, 0.30, 0.02), "fraction": 0.04},
      8             annot_kws={"fontsize": 20, "color":'black'})
      9             # cmap=sns.color_palette("YlOrBr", as_cmap=True));
     11 plt.ylabel("Site latitude ($\lambda$)", fontsize=20)

TypeError: pivot() takes 1 positional argument but 4 were given
<Figure size 1000x1000 with 0 Axes>