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

Data Properties

In addition to the methods we just covered, DataFrames have a few useful properties for figuring out what's inside:

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

print(df.shape)
# (997, 3)

print(df.columns)
# Index(['username', 'engagement_rate', 'platform'], dtype='object')

print(df.dtypes)
# username            object
# engagement_rate    float64
# platform            object

In the example above, we have:

  • A DataFrame with 997 rows and 3 columns
  • Columns named username (object), engagement_rate (float64), and platform (object)

You can get similar context by calling the .info() method, but these individual properties are convenient when you only need one piece of metadata.

Assignment

When the SnackStack analytics team receives a new device dataset, they need to quickly understand its structure before diving into analysis.

Complete the get_device_metadata function to return a new dictionary with these keys: