Pandas · Inspect and name your data
Google Search Analytics
Course overviewGoogle Search · Work with DataFrames

Inspect and name your data

Inspect column types and numeric summaries, then rename columns without changing their values.

Step 1 of 3 · Learn

Inspect before you transform

searches.dtypes lists each column's data type. searches.info() prints column types and non-missing counts; it returns None, so use it for inspection rather than saving it as your answer.

Summarize a numeric column

describe() returns count, mean, sample standard deviation, minimum, quartiles, and maximum for numeric columns. Missing values are excluded from these statistics.

indexscore
010
120
230
indexscore
count3
mean20
std10
min10
25%15
50%20
75%25
max30
describe() summarizes numeric values. The original rows are unchanged.

Give a column a clearer name

Pass a dictionary of old and new names to rename(columns=...). Assign the returned DataFrame to keep the renamed result without changing the source table.

indexnamescore
0Ari10
1Bo20
2Cam30
indexnamepoints
0Ari10
1Bo20
2Cam30
Renaming a column changes its label, not its values.
▷ Your turn

Return the numeric summary of response_ms from searches as a one-column DataFrame using describe(). Keep all eight statistic rows in their default order and preserve their labels as the index. Save it as result.

LANGUAGEPython · Pandas

Loading Python and Pandas…

Run the code to see DataFrame results here.