Skip to main contentSkip to solution

______________method can also be used to change the data values of a row to a particular value.

Solution

✅ Correct Option: 3

DataFrame.loc[] selects data by row label (and optionally column label), so assigning to it changes the selected values. For example, df.loc['row1'] = 0 sets every value in the row labelled row1 to 0, and df.loc['row1', 'col1'] = 5 changes a single cell.


Option 1: DataFrame.values is an attribute that returns the data as a NumPy array. It is not the standard way to select a row by label and assign to it.

loc[] uses labels, while iloc[] uses integer positions. Both can be used to assign values.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question