pandas输出时间戳以微秒为单位
我在我的DF有微秒的分辨率,这是非常重要的,但不pipe我尝试什么,我不能让Excel显示与.xls或.xlsx微秒的分辨率。 任何想法如何让他们显示,而无需明确转换为string?
使用最新版本的Pandas on GitHub(即将发布0.13.1),您可以在ExcelWriter()
指定Exceldate格式,如下所示:
import pandas as pd from datetime import datetime df = pd.DataFrame([datetime(2014, 2, 1, 12, 30, 5, 60000)]) writer = pd.ExcelWriter("time.xlsx", date_format='hh:mm:ss.000') df.to_excel(writer, "Sheet1") writer.close()
这将显示微秒时间(或至less几毫秒,因为这是Excel的显示限制):
另请参阅使用Python Pandas和XlsxWriter 。
- 时间戳格式dd / mm / yyyy hh:mm:ss到yyyy-mm-dd hh:mm:ss – MySQL
- 如何从Python中的Excel列表中读取时间戳
- 如何使用sha256签名为sha256证书添加时间戳,以便在Excel 2013中保护Excel VBAmacros代码?
- Excel公式从一行dynamic文本中findh:mm am / pm
- 以编程方式确定Excel文件(.xls)是否包含macros
- 在Excel中将时间戳从递减到新/不同的递增值
- 在Excel中分隔“m / d / yyyy h:mm”格式的单元格中的组件
- COUNTIFSdate之间的事件也是时间
- 如何在Excel上使用hh:mm:ss格式进行条件格式化