[Python] How to arrange time series data into ascending order

Discussão em 'Python' iniciado por Stack, Maio 29, 2025.

  1. Stack

    Stack Membro Participativo

    I have a dataframe with timeseries data

    Timestamp Values
    10-26-22 10.00 AM 1
    10-26-22 09.04 AM 5
    10.26-22 10.06 AM 6
    -------- --------
    10-27-22 3.32 AM 9
    10-27-22 3.36 PM 5
    10-27-22 3.31 PM 8
    -------- --------
    10-27-22 3.37 AM 8.23
    10-28-22 4.20 AM 7.2

    I tried to sort the timestamp column into ascending order by :

    df.sort_values("Timestamp", ascending = True, inplace= True)

    but this code is not working. I want to get the data like this:

    Timestamp Values
    10-26-22 09.04 AM 1
    10-26-22 10.00 AM 5
    10-26-22 10.06 AM 6
    -------- --------
    10-27-22 3.31 AM 9
    10-27-22 3.32 PM 5
    10-27-22 3.36 PM 8
    ------ --------
    10-27-22 3.37 AM 8.23
    10-28-22 4.20 AM 7.2

    Continue reading...

Compartilhe esta Página