enter image description hereWhat I am trying to do is count the number of renewals with the different sales trees.
In the case of NumberPlate "015ABN", the customer always renews with the same "company" twice renews with "boss 2", but renews with different "sellers" (seller1, seller2)
this is what i tried
data ['renewal'] = (np.where (data.NumberPlate == data.NumberPlate.shift (), 1, np.nan)) This information tells me that there was a renovation that works for me when I only compare two years but I don't know how to take into account the fields of sales trees.
The other problem I have has complicated me a bit is the difference in the dates on which they are renewed. In subtraction, I use it with a data ['difference'] = (np.where (data.NumberPlate == data.NumberPlate.shift (), data.Expedition_Date.diff (), np.nan))
This creates a field with the difference of days but returns the value of "366 days 04: 01: 19.177000000" but I have to subtract a year to be displayed in days. I must subtract 365 days.
I present three different cases each registration. Some customers are loyal to renew with the company, other customers renew with the boss and other customers renew with the seller.
I appreciate if you can help me with this
seller seller's boss Company NumberPlate Expedition_Date effective_date year difference renewal Company "Renewal seller's boss" "Renewal seller" Seller 1 Boss 1 Global Company 015ABN 2015-05-14 08:37:48.000 2015-05-15 08:37:48.000 2015 0 el mismo dia 1 1 1 Seller 1 Boss 2 Global Company 015ABN 2016-05-13 12:39:07.177 2016-05-15 08:37:48.000 2016 2 dias antes 2 1 1 Seller 2 Boss 2 Global Company 015ABN 2017-05-12 17:01:39.900 2017-05-15 08:37:48.000 2017 3 dias antes 3 2 1 Seller 1 Boss 1 Global Company 016ZYX 2015-05-15 08:37:48.000 2015-05-15 08:37:48.000 2014 0 1 1 1 Seller 1 Boss 1 Global Company 016ZYX 2016-05-12 12:39:07.177 2016-05-15 12:39:07.177 2015 3 2 2 2 Seller 1 Boss 1 Global Company 016ZYX 2017-05-11 17:01:39.900 2017-05-15 17:01:39.900 2016 4 3 3 3 Seller 1 Boss 1 Global Company 016ZYX 2018-05-14 17:01:39.900 2018-05-15 17:01:39.900 2017 1 4 4 4 Seller 1 Boss 1 Global Company 016ZYX 2019-05-15 17:01:39.900 2019-05-15 17:01:39.900 2018 0 5 5 5 Seller 1 Boss 1 Global Company 025ABC 2015-05-15 08:37:48.000 2015-05-15 08:37:48.000 2014 0 1 1 1 Seller 1 Boss 1 Global Company 025ABC 2016-05-13 12:39:07.177 2016-05-15 12:39:07.177 2015 2 2 2 2 Seller 2 Boss 1 Global Company 025ABC 2017-05-10 17:01:39.900 2017-05-15 17:01:39.900 2016 5 3 3 1 Seller 1 Boss 1 Global Company 2 025ABC 2018-05-14 17:01:39.900 2018-05-15 17:01:39.900 2017 4 1 1 1 Seller 1 Boss 1 Global Company 2 025ABC 2019-05-15 17:01:39.900 2019-05-15 17:01:39.900 2018 0 2 2 2
Aucun commentaire:
Enregistrer un commentaire