I am trying to determine the best way to add a column to my pandas dataframe that converts total minutes (which is in int format) into HH:MM format. I am aware that the easiest way to do this is with datetime, but I can't seem to figure out the best way to convert the data from a Series to make this happen.
Here is the error message:
TypeError: unsupported type for timedelta minutes component: Series
Code (e.g. 346.0):
df['minutes_asleep_hm'] = str(timedelta(minutes=df['minutes_asleep']))[:-3]
Type:
Name: minutes_asleep, dtype: float64