[944]AttributeError:‘DataFrame‘ object has no attribute ‘sort‘,‘as_matrix‘,‘ix‘

AttributeError:‘DataFrame’ object has no attribute ‘sort’

解决办法:将“sort”改为“sort_values”。

如:

c_df_sort=c_df.sort(columns=0,ascending=False)

改为:

c_df_sort=c_df.sort_values(0,ascending=False)

参考:https://blog.csdn.net/qq_34197944/article/details/102879943

AttributeError DataFrame object has no attribute as_matrix

查看pandas的文档发现新版的pandas里面as_matrix属性已经没有了

解决办法:

1、装旧版的pandas
2、改用下列代码

#df.as_matrix()改写成
df.values

或者
import numpy as np 
np.array(df) # 等价于df.as_matrix()

参考:https://www.pythonheidong.com/blog/article/287104/52173047825a6eae8763/
https://daguang.blog.csdn.net/article/details/106605707

AttributeError: ‘DataFrame’ object has no attribute ‘ix’

在pandas的1.0.0版本开始,移除了Series.ix and DataFrame.ix 方法。

解决方法:使用DataFrame的loc方法或者iloc方法进行替换。

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

周小董

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值