KnowledgeBoat Logo
|

Informatics Practices

Assertion. While changing the values of a column in a dataframe, if the column does not exist, an error occurs.

Reason. If values are provided for a non-existing column in a dataframe, a new column is added with those values.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

Python Pandas

1 Like

Answer

A is false but R is true.

Explanation
While changing the values of a column in a dataframe where the column does not exist does not cause an error. Instead, a new column with those values is added to the dataframe. If values are provided for a non-existing column in a dataframe, a new column is added with those values.

Answered By

2 Likes


Related Questions