'How to use where method in python when getting error everytime?

I am trying to apply a .where function to this data frame so that it filters by pitch type, but am getting the error "Array conditional must be same shape as self" every-time. Never had this issue with any past data frames,

included an image of the error

as well as

an image of the column in the dataframe



Solution 1:[1]

I'm not sure what are.equal_to is, but this should work for you:

fastball = march[march["TaggedPitchType"] == "Fastball"]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 richardec