PJ1*_*J15 4 python attributeerror pandas
我有最新版本的 pandas,2.0.1。
这个简单的代码:
import pandas
pandas.Int64Index
Run Code Online (Sandbox Code Playgroud)
给出错误:
AttributeError: module 'pandas' has no attribute 'Int64Index'
Run Code Online (Sandbox Code Playgroud)
我尝试使用pip和卸载并重新安装 pandas conda,还重新启动了 Jupyter 笔记本,但仍然收到错误。
2.0.1 是 pandas 2.0 重大更新之后的次要版本,删除了旧的已弃用代码,例如Int64Index. 从 2.0 更改日志开始,索引现在可以保存 numpy 数字 dtypes
Int64Index、UInt64Index 和 Float64Index 在 pandas 版本 1.4 中已弃用,现已删除。相反,应该直接使用 Index,现在它可以采用所有 numpy 数字 dtypes,即 int8/ int16/int32/int64/uint8/uint16/uint32/uint64/float32/float64 dtypes
当主要版本中缺少某些内容时,请务必检查变更日志。
相当于Int64Index(导入 numpy 后)
pd.Index([1, 2, 3], dtype=np.int64)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8154 次 |
| 最近记录: |