Home > database >  Convert 34:37 into 34.37 in pandas [closed]
Convert 34:37 into 34.37 in pandas [closed]

Time:09-21

I have column that gives minutes values.

     MIN
1   38:37
2   31:32
3   27:48
4   23:51
5   24:00
6   38:27
7   25:13
8   29:00
9   26:32

I would like to convert it into numbers. Because of the semicolon, python thinks its text.

This is the desired output.

     MIN
1   38.37
2   31.32
3   27.48
4   23.51
5   24.00
6   38.27
7   25.13
8   29.00
9   26.32   

CodePudding user response:

Try by replacing : to .. Then convert them to float

df["MIN"] = df["MIN"].str.replace(":", ".").astype(float)
  • Related