Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
How do you add a new column named 'Height' with values [5.5, 6.0, 5.8]?
Remember to use the DataFrame variable and assign the values.
What command would you use to delete a column named 'Weight'?
Use the drop method, which takes column names as parameters.
What method is used to add a new column in a Pandas DataFrame?
Think about how you normally assign values in Python.
True or False: The drop() method can remove multiple columns at once.
Recall how we've handled multiple columns in discussions.
Create a DataFrame with three columns: 'Product', 'Price', and 'Sales'. Add a new column 'Profit' calculated as Price - Sales.
Make sure to perform the subtraction correctly to get the profit.
Given a DataFrame with multiple columns, write code that removes any column whose name starts with 'temp_'.
Use list comprehension to generate the list of columns to drop.
6 more questions in this section. Enroll free to practise them all.
Enroll free