Seaborn 0.11.2 has a problem with lineplot

Will raise:

ValueError: cannot reindex from a duplicate axis

Eg. in Ch 7, 05

ax = sns.lineplot(x='alpha',
                  y='ic',
                  data=ridge_scores,
                  estimator=np.mean,
                  label='Mean',
                  ax=axes[0])

Use conda install seaborn==0.11.1 downgrade to 0.11.1 solve the problem

See

or

For ValueError: cannot reindex on an axis with duplicate labels

You can do this:

lasso_scores.groupby('alpha').ic.agg(['mean', 'median'])

then:

lasso_scores = lasso_scores.drop_duplicates()
lasso_scores = lasso_scores.reset_index(drop=True)

OR

lasso_scores.groupby('alpha').agg({'ic': ['mean', 'median']}).reset_index(drop=True)

The last one liner does everything the other three lines do and still plots with the latest version of seaborn