简体   繁体   English

如何读取 pandas 中的时间列以及如何将其转换为毫秒

[英]How to read time column in pandas and how to convert it into milliseconds

df=pd.read_excel("XYZ.xlsb",engine='pyxlsb',dtype={Time'})

Output 
0.2083333333333333333332

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我想读这个时间和 excel 完全一样。我想转换成毫秒,因为我想用时间来计算百分比的时间差以便进一步工作

try dividing the microsecond of the datetime by 1000尝试将日期时间的微秒除以 1000

def get_milliseconds(dt):
    return dt.microsecond / 1000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以毫秒为单位将列转换为时间? - how to convert column to time with milliseconds? pandas python 如何将持续时间转换为毫秒? - pandas python how to convert time duration to milliseconds? 如何在python熊猫中将日期时间转换为毫秒 - how to convert datetime to milliseconds in python pandas 在 Pandas 中,如何将字符串转换为以毫秒为单位的日期时间对象? - In Pandas, how to convert a string to a datetime object with milliseconds? 如何在pandas中将一列微秒转换为毫秒,另一列聚合模式 - How to convert micro to milliseconds in one column and aggregate mode of another column in pandas 熊猫:如何使用between_time和毫秒? - Pandas: how to use between_time with milliseconds? 如何将 csv 带毫秒的日期和时间转换为带毫秒的日期时间 - How to convert csv date and time with milliseconds to datetime with milliseconds 如何在 pandas 中转换日期时间和时间的列 dtypes - how to convert column dtypes for DateTime and Time in pandas 如何在python / pandas的毫秒部分转换带逗号(,)的datetime-String? - How to convert a datetime-String with a comma (,) in the milliseconds part in python/pandas? 在熊猫中,如何将自1970年1月1日起的毫秒数转换为数据类型时间戳? - In pandas, how to convert milliseconds since Jan 1, 1970 to datatype timestamp?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM