I am new in handling pandas Df. I want to compare every column elements of each row.
Requirement: If all elements in the columns of 1 row is zero then input 'More False' in new column filled with zeros corresponding to its index.
See below Df for clear understanding
My Data Frame:
Time Brake Speed Strgangle index Target
0 1678.39 0.000000 0.000000 0.000000 167739 0
1 1678.40 15.00000 0.000000 0.000000 167740 0
2 1678.41 0.000000 8.000000 0.000000 167741 0
3 1678.42 0.000000 0.000000 2.000000 167742 0
4 1678.43 5.000000 20.10000 0.000000 167743 0
5 1678.44 0.150000 0.000000 -1.16500 167744 0
6 1678.45 0.000000 20.10 2.000000 167742 0
7 1678.47 0.150000 25.00000 -1.16500 167744 0
My Requirement :
1. If Brake = 0, Speed =0, Strg angle=0
--> Input a str in corresponding Target index as 'More False'
2. If Brake = Value, Speed = Value, Strg angle=Value
--> Input a str in corresponding Target index as 'More True'
3. As above conditions i should input the string in Target column based on my requirement
.
Actual Df required :
Time Brake Speed Strgangle index Target
0 1678.39 0.000000 0.000000 0.000000 167739 MoreFalse
1 1678.40 15.00000 0.000000 0.000000 167740 False
2 1678.41 0.000000 8.000000 0.000000 167741 False
3 1678.42 0.000000 0.000000 2.000000 167742 False
4 1678.43 5.000000 20.10000 0.000000 167743 True
5 1678.44 0.150000 0.000000 -1.16500 167744 True
6 1678.45 0.000000 20.10 2.000000 167742 True
7 1678.47 0.150000 25.00000 -1.16500 167744 MoreTrue
I have tried using an If loop to input my required string in Target column, but i am receiving SettingWithcopy warning.
I am sure that there will be some easy approach for the above problem.