Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Kdeplot | Distributions of Data
Deep Dive into the seaborn Visualization

book
Kdeplot

A kdeplot plot is a method for visualizing the distribution of observations in a dataset analogous to a histogram. KDE represents the data using a continuous probability density curve in one or more dimensions.

carousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-imgcarousel-img
Aufgabe

Swipe to start coding

  1. Create the kdeplot using the seaborn library:
  • Set the x parameter equals the 'max_temp';
  • Set the hue parameter equals the 'month';
  • Set the multiple parameter equals the 'stack';
  • Disable the legend;
  • Add the filling;
  • Set the data;
  • Display the plot.

Lösung

import warnings

# Ignore all warnings
warnings.filterwarnings('ignore')

# Importing libraries needed
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/66ba0c8e-8422-413c-b7e1-74bd24c61656/weather+upd.csv')

# Setting the style
sns.set_style('ticks', {'figure.facecolor' : 'lightcyan'})
# Create a kdeplot
sns.kdeplot(# Set the x
x = 'max_temp',
# Set the hue
hue = 'month',
# Set the multiple
multiple = 'stack',
# Disable the legend
legend = False,
# Add the filling
fill = True,
# Set the data
data = df)

# Display the plot
plt.show()

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2
import warnings

# Ignore all warnings
warnings.filterwarnings('ignore')

# Importing libraries needed
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# Reading the file
df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/66ba0c8e-8422-413c-b7e1-74bd24c61656/weather+upd.csv')

# Setting the style
sns.set_style('ticks', {'figure.facecolor' : 'lightcyan'})
# Create a kdeplot
___(# Set the x
___,
# Set the hue
hue = ___,
# Set the multiple
multiple = ___,
# Disable the legend
___,
# Add the filling
___ = True,
# Set the data
___)

# Display the plot
___

Fragen Sie AI

expand
ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

some-alt