Informatics Practices

Assertion (A): We can add a new column in an existing DataFrame.

Reason (R): DataFrames are size mutable.

  1. Both A and R are true, and R is the correct explanation of A.
  2. Both A and R are true, and 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

Both A and R are true, and R is the correct explanation of A.

Explanation
We can add a new column to an existing DataFrame using the .at or .loc methods. A DataFrame is a two-dimensional data structure that is size-mutable. This means that we can add or drop elements in an existing DataFrame object without needing to create a new DataFrame internally.

Answered By

2 Likes


Related Questions