I have a DataFrame as below. Based on few conditions I need to retrieve the column
Wifi_User1 Wifi_User2 Wifi_User3 Thermostat Thermo_Pos Act_User1 Act_User2 Act_User3 Be_1 Be_2 Be_3
-58 -48 -60 18 -50 0 1 0 1 1 3
-67 -45 -60 18 -50 1 0 0 1 2 3
-40 -65 -65 18 -50 1 0 1 3 2 3
-67 -45 -44 18 -50 0 0 1 2 3 4
-65 -68 -70 18 -50 0 0 0 1 3 2
-55 -60 -65 24 -50 0 0 0 1 3 2
-72 -56 -45 24 -50 0 1 0 2 1 1
-75 -45 -60 24 -50 1 1 0 3 1 1
-77 -48 -65 24 -50 1 1 0 1 1 2
-70 -58 -68 24 -50 1 0 0 2 2 3
-70 -75 -65 24 -50 0 0 0 2 2 3
-55 -45 -65 24 -50 0 0 0 2 1 4
-65 -55 -70 15 -50 0 0 0 2 1 4
-65 -55 -70 15 -50 0 1 0 2 1 1
-55 -45 -65 15 -50 0 1 0 1 1 4
-67 -45 -44 15 -50 1 0 0 2 1 4
-65 -68 -70 15 -50 1 0 0 2 1 1
-67 -45 -44 15 -50 1 0 0 2 1 4
The condition is :
if (Wifi_User1!=Wifi_User2) or (Wifi_User2!=Wifi_User3)
or (Wifi_User3!=Wifi_User1) or (Wifi_User1!=Wifi_User2!=Wifi_User3)
and when the thermostat value is changing
Then take, the difference between Wifi_user1 & Thermo_Pos, and same goes for 2 and 3. Take the minimum among these difference, and return 1 in if its Wifi_User1, 2 if its Wifi_User2 and 3 if its Wifi_User3 in the new column say, "User".
Aucun commentaire:
Enregistrer un commentaire