Answers for "how to apply a function to multiple columns in pandas dataframe"

0

how to apply a function to multiple columns in pandas dataframe

>>> print df
   A  B  C
0 -1  0  0
1 -4  3 -1
2 -1  0  2
3  0  3  2
4  1 -1  0
>>> print df.applymap(lambda x: x>1)
       A      B      C
0  False  False  False
1  False   True  False
2  False  False   True
3  False   True   True
4  False  False  False
Posted by: Guest on October-17-2021

Code answers related to "how to apply a function to multiple columns in pandas dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language