1

enter image description here[Car sells data]

from the image, how do access rows that are expensive and too old?

"dataset[dataset['Price_description']=='Expensive' & dataset['Car_health']=='Too old']"

that was my code but its wrong, please try and correct me

Nkango
  • 11
  • 2

1 Answers1

0

You need to wrap the two equality statements in parentheses:

dataset[(dataset['Price_description']=='Expensive') & (dataset['Car_health']=='Too old')]

Or use eg:

dataset[dataset['Price_description'].eq('Expensive') & dataset['Car_health'].eq('Too old')]
mozway
  • 81,317
  • 8
  • 19
  • 49