BaşlayınÜcretsiz Başlayın

Extracting features for correlation

In this exercise, you'll work with a version of the salaries dataset containing a new column called "date_of_response".

The dataset has been read in as a pandas DataFrame, with "date_of_response" as a datetime data type.

Your task is to extract datetime attributes from this column and then create a heat map to visualize the correlation coefficients between variables.

Seaborn has been imported for you as sns, pandas as pd, and matplotlib.pyplot as plt.

Bu egzersiz

Exploratory Data Analysis in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Extract the month from "date_of_response", storing it as a column called "month".
  • Create the "weekday" column, containing the weekday that the participants completed the survey.
  • Plot a heat map, including the Pearson correlation coefficient scores.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Get the month of the response
salaries["month"] = ____["____"].____.____

# Extract the weekday of the response
salaries["weekday"] = ____

# Create a heatmap
sns.____(____.____(numeric_only=True), annot=____)
plt.show()
Kodu Düzenle ve Çalıştır