Skip to content

Fix deprecated sns.factorplot, replace with sns.catplot - #816

Open
KayotPoziloy wants to merge 1 commit into
Yorko:mainfrom
KayotPoziloy:fix-deprecated-factorplot
Open

Fix deprecated sns.factorplot, replace with sns.catplot#816
KayotPoziloy wants to merge 1 commit into
Yorko:mainfrom
KayotPoziloy:fix-deprecated-factorplot

Conversation

@KayotPoziloy

Copy link
Copy Markdown

What

Replaces the deprecated sns.factorplot() call with sns.catplot() in
assignment02_analyzing_cardiovascular_desease_data.ipynb.

Why

sns.factorplot() has been deprecated since seaborn 0.9 and was fully
removed in later seaborn releases (aliased to catplot() before removal).
Running the notebook with a modern seaborn version raises an
AttributeError: module 'seaborn' has no attribute 'factorplot', which
breaks the assignment for anyone using an up-to-date environment.

Changes

  • Replaced sns.factorplot(x='variable', y='count', hue='value', data=df_uniques, kind='bar', size=12) with the modern sns.catplot()
    equivalent.
  • Replaced the deprecated size parameter with height.
  • Added g.set_xticklabels(rotation=45, ha='right') so that category
    labels on the x-axis don't overlap, since the longer variable names
    no longer fit on one line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant