[Python] How do I Convert data type in Python? [closed]

Discussão em 'Python' iniciado por Stack, Julho 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have written this code:

    df.loc[df['Profile Name'] == 'karladdo201', 'Duration'].astype('timedelta64').sum()


    and get this value:

    Timedelta('8 days 12:02:45')


    How do I get a values similar or in this format ?: 4138000.0

    from writing this code:

    viewTime = {}
    viewTime.update({"karladdo201": df.loc[df['Profile Name']=='karladdo201','Duration'].astype('timedelta64').sum()})
    viewTime


    They all come from a dataframe of my Netflix viewing history. I am using jupyter lab

    Continue reading...

Compartilhe esta Página