[已解决]Pands里面报AttributeError: type object ‘object‘ has no attribute ‘dtype‘

执行代码时,

table_b = pd.DataFrame(columns=['测试1','测试2'])
print(table_b)

报错

AttributeError: type object 'object' has no attribute 'dtype'

搜索原因,大多数都说是版本问题,故在此记录下
执行代码:

table_b = pd.DataFrame(columns=['测试1','测试2'],dtype=object)

错误解决

总结

报错翻译:AttributeError:类型对象’object’没有属性’dtype’
为此可以尝试指定一下dtype的类型

猜你喜欢

转载自blog.csdn.net/m0_57021623/article/details/129774480
今日推荐