Pandas · Select columns
Google Search Analytics
Course overviewGoogle Search · Work with DataFrames

Select columns

Choose columns and distinguish a Series from a DataFrame.

Step 1 of 3 · Learn

Keep the columns you need

Pass a list of column names to select several columns. The result keeps them in the order you specify.

indexidnameteam
01AriA
12BoB
23CamA
indexnameteam
0AriA
1BoB
2CamA
Only the requested columns remain; no rows are removed.

One column, two output types

searches["query"] returns a Series. searches[["query"]] returns a one-column DataFrame. Use the output type requested by the exercise.

▷ Your turn

Return search_id, query, and device from searches, in that order. Keep every row and save the DataFrame as result.

LANGUAGEPython · Pandas

Loading Python and Pandas…

Run the code to see DataFrame results here.