Skip to content

Tag: dataframe

dedup records(window function pandas)

Hi I am looking to dedup my records ordered by cancel date so I will only be interested in the most recent record. sample data id cancel_date type_of_fruit 1 2021-03-02 apple 1 2021-01-01 apple 2 2021-02-01 orange expected output id cancel_date type_of_fruit 1 2021-03-02 apple 2 2021-02-01 orange I wrote the …

Duration between two timestamps

I have a dataframe with different timestamp for each user, and I want to calculate the duration. I used this code to import my CSV files: df.head() And I want to get something like that I’ve used this code, but doesn’t work for me Answer Operations which occur over groups of values are GroupBy ope…