Keep the columns you need
Pass a list of column names to select several columns. The result keeps them in the order you specify.
| index | id | name | team |
|---|---|---|---|
| 0 | 1 | Ari | A |
| 1 | 2 | Bo | B |
| 2 | 3 | Cam | A |
| index | name | team |
|---|---|---|
| 0 | Ari | A |
| 1 | Bo | B |
| 2 | Cam | A |
Choose columns and distinguish a Series from a DataFrame.
Step 1 of 3 · Learn
Pass a list of column names to select several columns. The result keeps them in the order you specify.
| index | id | name | team |
|---|---|---|---|
| 0 | 1 | Ari | A |
| 1 | 2 | Bo | B |
| 2 | 3 | Cam | A |
| index | name | team |
|---|---|---|
| 0 | Ari | A |
| 1 | Bo | B |
| 2 | Cam | A |
searches["query"] returns a Series. searches[["query"]] returns a one-column DataFrame. Use the output type requested by the exercise.
Return search_id, query, and device from searches, in that order. Keep every row and save the DataFrame as result.
Loading Python and Pandas…
Run the code to see DataFrame results here.