We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Inspecting Columns

Once you understand your DataFrame as a whole, you can inspect individual Series (columns) with a few more tools:

df = pd.read_csv("games.csv")

print(df["genre"].unique())
# ['RPG' 'Shooter' 'Puzzle']

print(df["genre"].value_counts())
# RPG        150
# Shooter    120
# Puzzle      80

In the example above, there are:

  • 3 unique values in the "genre" column
  • 150 rows where "genre" is "RPG", 120 rows where it's "Shooter", etc.

The .value_counts() method lists results in descending order by default.

Assignment

SnackStack's support team needs to understand what types of devices are in their dataset and how many of each type exist.

Complete the analyze_device_types function. It accepts a DataFrame and returns a tuple of the unique device types and a count of each type.