python - 重新读取excel而不格式化日期
问题描述
熊猫 1.1.0 Python 3.8
当我尝试使用read_excel 方法读取 excel 文件时
文件加载正常,但 excel 在某些列中有日期格式,pandas 会自动更改格式
我想避免这种行为
解决方案
您可以在 read_excel 函数中设置 dtypes 参数,例如
df=pd.read_excel('excel.xlsx', dtypes={'datecolumnname1':str, 'datecolumnnam2':str,...})
推荐阅读
- c - 在浮点输入中派生十进制数有时会将该值减去 1
- ngrx - 如何扩展 EntityCollectionReducerMethods NgRx 数据
- .htaccess - Cache-Control + mod_expires 设置在 .htaccess 但利用浏览器缓存仍然不起作用
- sql - 将数据从 Teradata 数据湖加载到 SSMS 数据库表时的时间戳转换
- python - Docker容器没有找到这样的文件目录
- android - gradle.lang.MissingPropertyException
- python - 哪个生产速度更快?磁盘上的文件与内存中的文件(StringIO,BytesIO)
- javascript - 导入模块时 Web Worker 不工作,即使在使用 worker-loader 时也是如此
- ajax - 在 Rails-React 上 React Ajax 400 错误请求
- php - 代码适用于 php 5 但不适用于 php 7,从类函数返回数组的单个元素