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

Finding the number of unique values

You would like to practice some of the categorical data manipulation and analysis skills that you've just seen. To help identify which data could be reformatted to extract value, you are going to find out which non-numeric columns in the planes dataset have a large number of unique values.

pandas has been imported for you as pd, and the dataset has been stored as planes.

Bu egzersiz

Exploratory Data Analysis in Python

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

Egzersiz talimatları

  • Filter planes for columns that are of "object" data type.
  • Loop through the columns in the dataset.
  • Add the column iterator to the print statement, then call the function to return the number of unique values in the column.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Filter the DataFrame for object columns
non_numeric = planes._____("____")

# Loop through columns
for ____ in non_numeric.____:
  
  # Print the number of unique values
  print(f"Number of unique values in {____} column: ", non_numeric[____].____())
Kodu Düzenle ve Çalıştır