

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: What Is Pandas?
incomplete
2: Series
incomplete
3: DataFrames
incomplete
4: Derived Columns
incomplete
5: Series vs. DataFrame
incomplete
6: Filtering Data
incomplete
7: The Index in Pandas
incomplete
8: Custom Indexes
incomplete
9: Loading Data
incomplete
10: Inspect Head
incomplete
11: Info & Describe
incomplete
12: Inspecting Workflow
incomplete
13: Data Properties
incomplete
14: Inspecting Columns
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
In addition to the methods we just covered, DataFrames have a few useful properties for figuring out what's inside:
.shape property returns a tuple of the number of rows and columns in the DataFrame..columns property returns the names of the columns..dtypes property returns the data types of each column.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:
DataFrame with 997 rows and 3 columnsusername (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.
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: