Attribute: JointGrid has no attribute annotate?

因为提问的字数限制,我就更改了报错内容,实际是:AttributeError: 'JointGrid' object has no attribute 'annotate'

使用seaborn画图时为想为jointplot添加一个相关系数和P值,之前在使用的时候从来没有报错过,但是今天运行的收突然报错,求问如何解决,看过了现有的一篇解决的文章,说更新seaborn就OK,但是我的seaborn已经是最新版本,解决无效。

g = sns.jointplot(x=xmn, y="丰度", data=df_last, kind="reg", truncate=False,

                  color="m", height=10)

rsquare = lambda a, b: stats.pearsonr(a, b)[0] ** 2

g = g.annotate(stats.pearsonr)

顺便询问一下,除了ix之外,pandas还有没有方式可以使用标签和索引混合提取数据?

报错是因为JointGrid的annotate方法已在seaborn v0.9弃用,在v0.11删除,替代方法,在matplotlib的figures中使用JointGrid.ax_joint.texthttps://github.com/mwaskom/seaborn/issues/2306,http://seaborn.pydata.org/generated/seaborn.JointGrid.html

另外,就目前所知除ix外还没有能混合提取的,而且ix也弃用,代之用loc标签索引,iloc整数索引

您好,我是问答小助手,你的问题已经有小伙伴为您解答了问题,您看下是否解决了您的问题,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>> https://vip.csdn.net/askvip?utm_source=1146287632