Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Datensatz Untersuchen | Konfidenzintervall
Statistik Lernen mit Python

book
Datensatz Untersuchen

Aufgabe

Swipe to start coding

  1. Die CSV-Datei einlesen und der Variablen data zuweisen.
  2. Die ersten fünf Beobachtungen des in der Variablen data gespeicherten Datensatzes anzeigen.
  3. Ein histplot mit folgenden Attributen erstellen:
    • Datensatz auf data setzen;
    • 'body_mass_g' für die X-Achse verwenden;
    • Den Parameter kde auf True setzen.

Lösung

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

# Read csv file
data = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/section_1/confidence.csv', index_col = 0)

# Output the first five observations
print(data.head())

# Create the histplot
plot = sns.histplot(data = data,
x = 'body_mass_g',
kde = True)
plot.set_title('Penguins')
plot.set(xlabel = 'The Mass', ylabel = 'The Quantity')
plt.show()
War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 5. Kapitel 1
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as st
import numpy as np

# Read csv file
data = ___.___('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/a849660e-ddfa-4033-80a6-94a1b7772e23/section_1/confidence.csv', index_col = 0)

# Output the first five observations
print(___)

# Create the histplot
plot = ___.___(data = ___,
x = '___',
___)
plot.set_title('Penguins')
plot.set(xlabel = 'The Mass', ylabel = 'The Quantity')
plt.show()

Fragen Sie AI

expand
ChatGPT

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

some-alt