Update data based on cond (condition) if cond=True then by NaN or by other
Parameters
cond : Condition to check , if True then value at other is replaced. If False then nothing is changed. other : If cond is True then data given here is replaced. inplace: Default is False , if it is set True then original DataFrame is changed. axis : integer , default None , Alignment towards Axis ( if required ) level : Level of alignment if required. error : default is 'raise' , It can take value 'raise' or 'ignore' try_cast : default False,
Difference between MASK & WHERE
MASK: Data is updated as NaN (if other is not given ) if cond ( condition ) is True.
WHERE : Data is updated as NaN (if other is not given ) if cond ( condition ) is False.
DataFrame.where()
NAME ID MATH ENGLISH
0 Ravi 1 80 81
1 Raju 2 40 70
2 Alex 3 -7 40
3 Ron 4 70 50
4 King 5 82 60
5 Jack 6 30 30
inplace
By default inplace=Flase , this will not change the original DataFrame. By making it to True that is inplace=True we can change the original DataFrame.