jeudi 1 juillet 2021

Python (Pandas) if condition inside groupby

I have the following table.

      time                   userid   market   device    query      querytype   browser
0     2020-07-01  04:47:21   A        EN-US    PC        WEATHER    WEATHER     EDGE
1     2020-07-01  07:23:52   C        ZH-CN    MOBILE    RECIPIES   FOOD        SAFARI
2     2020-07-01  15:32:57   D        EN-GB    TABLET    DOGS       ANIMALS     CHROME
3     2020-07-01  17:16:21   A        EN-CA    PC        SEATTLE    CITY        EDGE
4     2020-07-01  21:07:21   D        EN-GB    TABLET    DOG FOOD   ANIMAL      CHROME
5     2020-07-01  22:26:21   E        DE-DE    MOBILE    IPHONE     PRODUCTS    CHROME

And I am trying to answer the following question: Add a column to the table which contains the user's next query

I really do not have any clues. Please help

Aucun commentaire:

Enregistrer un commentaire