Which of the following is equivalent of AND operator while using Boolean…
2023
Which of the following is equivalent of AND operator while using Boolean indexing on data frames ?
- A.
&&
- B.
@
- C.
&
- D.
N
Attempted by 3867 students.
Show answer & explanation
Correct answer: C
When performing Boolean indexing on DataFrames in pandas, the element-wise AND operation is represented by the & operator. The & operator performs element-wise logical AND between two boolean arrays, which is required for filtering DataFrames based on multiple conditions. Note: The && operator is not supported in pandas for element-wise operations and may lead to errors. Similarly, @ and N are not valid operators for Boolean indexing.