I am trying to convert my time watched in a netflix show to a float so I can total it up. I cannot figure out how to convert it. I have tried many ways, including:

temp['Minutes'] = temp['Duration'].apply(lambda x: float(x))

Error: ValueError: could not convert string to float: '00:54:45'
2022-05-18 05:21:42 00:54:45    NaN Ozark: Season 4: Mud (Episode 13)   NaN Amazon FTVET31DOVI2020 Smart TV 00:54:50    00:54:50    US (United States)  Wednesday   2022-05-18

I have pulled the day of week and Day out but I would like to plot it just for fun and think the minutes would be the best to add up over time.

  • $\begingroup$ You could just use plot them using timedelta datatypes. However, if you still want to use float, then convert your seconds into minutes by (seconds/60). $\endgroup$
    – Danny
    May 27 at 8:04
  • 1
    $\begingroup$ Thank you! I saw something on timedelta types and will check it out. $\endgroup$
    – cbhami
    May 27 at 12:22


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.