Hello! I have a dataframe called Jan_df with a column called “Roll Time” which has values of time duration as minutes:seconds. For example 15:42 means 15 minutes and 42 seconds. The data type of this column is “object” (string).
I would like to get the average duration of all the values in this column. I tried this:
Jan_Avg_Roll_Time = Jan_df['ROLL TIME'].mean()
But I get an error saying TypeError : Could not convert the values to numeric.
So I tried:
Jan_df['ROLL TIME'] = Jan_df['ROLL TIME'].astype(int)
But this gave ValueError : invalid literal for int() with base 10: ‘16:41’
(16:42 was the first value in the column).
So what can I do to actually get the average of this column successfully?
Thanks so much for any insights!