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.
Questo esercizio fa parte del corso
Exploratory Data Analysis in Python
Istruzioni dell'esercizio
- Filter
planesfor 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.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# 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[____].____())