Consider a data frame df with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2', 'r3']. Which of the following expression filters the rows whose column B values are greater than 45 and column 'C' values are less than 30?

Questions & AnswersCategory: Programming LanguageConsider a data frame df with columns ['A', 'B', 'C', 'D'] and rows ['r1', 'r2', 'r3']. Which of the following expression filters the rows whose column B values are greater than 45 and column 'C' values are less than 30?
Adam asked 3 years ago

Consider a data frame df with columns [‘A’, ‘B’, ‘C’, ‘D’] and rows [‘r1’, ‘r2’, ‘r3’]. Which of the following expression filters the rows whose column B values are greater than 45 and column ‘C’ values are less than 30?
a. df.loc[(df.B > 45) & (df.C < 30)]
b. df[df.B > 45 & df.C < 30]
c. df.loc[df.B > 45 & df.C < 30]
d. (df.B > 45) & (df.C < 30)