Skip to content Skip to sidebar Skip to footer

"attributeerror: 'float' Object Has No Attribute 'all'" When Using "where" Method From Pandas

I'm trying to use Pandas' where method but I stuck with an error. Here is a very small example. Give the file Chamber,Treatment 1,Sem palha 1,Sem palha 1,Sem palha 2,Sem palha 2,Se

Solution 1:

Your syntax would actually work in new versions of pandas. You can upgrade pandas on Ubuntu using

sudo pip install --upgrade pandas

Or if you are using python3, then

sudo pip3 install --upgrade pandas

Solution 2:

As unutbu pointed out in the comment, where seems to be a "cell-wise" selection. These to variants work as expected:

sample[sample["Chamber"] == 1]

and

sample.query("Chamber == 1")

Post a Comment for ""attributeerror: 'float' Object Has No Attribute 'all'" When Using "where" Method From Pandas"