python-3.x - 'float' 对象没有属性 'utcoffset'", '发生在索引 30852'
问题描述
我试图使用以下代码本地化数据集的时区:
df['Date and Time'] = df['Date and Time'].astype('datetime64')
df['Date and Time'] = df.apply(lambda r : r['Date and Time (RW)'].tz_localize(r['Zone']), 1)
但是,我不断收到错误消息,上面写着:
"'float' 对象没有属性 'utcoffset'", '发生在索引 30852"
当我试图查看导致错误的数据时:
df[(df.index==30852)] # actually it shows that there is no data.
我尝试通过运行以下代码删除该索引处的数据:
df.drop(df.index[30852], inplace=True)
但它没有用,因为没有数据。
什么可能导致此错误?
解决方案
推荐阅读
- javascript - 嘿!我该如何解决我的代码,该代码显然没有从浏览器的 KeyboardEvent 中正确获取 .key 属性?
- c# - C#动态计算列表中的出现次数
- java - 从同一地图的值中的内容更改地图键
- highcharts - Highcharts.js 问题:是否可以在 MACD 指标直方图之外不画线?
- batch-file - 如何在文本文件中查找行并导出行号
- laravel - ErrorException:试图获取非对象的属性 - laravel
- mysql - Laravel 中的 OrderByRaw() 然后 orderBy()
- magento2 - 尝试添加新子类别时 Magento 产品类别消失
- java - JBoss EAP 7 java.lang.IllegalArgumentException 通过 Gradle 脚本配置 JBoss EAP 7 数据源的问题
- bash - 用于循环 docker ps 命令以停止和删除旧容器的 Bash 脚本