0
I used this code to read excel file
df=pd.read_excel("XYZ.xlsb",engine='pyxlsb',dtype={'Time':str})

This is just to show what i am getting after reading excel file.

import pandas as pd
import numpy as np
data = {'Name':['T1','T2','T3'],
    'Time column in excel':['01:57:15', '00:30:00', '05:00:00'],
    'Time column in Python':['0.0814236111111111', '0.0208333333333333', '0.208333333333333']}
       
df = pd.DataFrame(data)
print (df)

| left | Time column in excel | Time column in Python|
| T1  | 01:57:15              |  0.0814236111111111  |
| T2  | 00:30:00              |  0.0208333333333333  |
| T3  | 05:00:00              |  0.208333333333333   |

I want read this time exactly as in excel.and want to convert into milliseconds,as i want to use time to calculate time difference in percentage for further working

Sanju M
  • 15
  • 4

1 Answers1

0

try dividing the microsecond of the datetime by 1000

def get_milliseconds(dt):
    return dt.microsecond / 1000
Golden Lion
  • 3,840
  • 2
  • 26
  • 35