加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python – 在seaborn中使用distplot的FutureWarning

发布时间:2020-12-20 11:08:11 所属栏目:Python 来源:网络整理
导读:参见英文答案 FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]`????????????????????????????????????4个 每当我尝试使用seaborn的distplot时,我都会出现这个警告,我似乎无法弄清楚我做错了什
参见英文答案 > FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]`????????????????????????????????????4个
每当我尝试使用seaborn的distplot时,我都会出现这个警告,我似乎无法弄清楚我做错了什么,对不起,如果这很简单的话.

警告:

FutureWarning: Using a non-tuple sequence for multidimensional
indexing is deprecated; use arr[tuple(seq)] instead of arr[seq].
In the future this will be interpreted as an array index,
arr[np.array(seq)],which will result either in an error or a
different result. return np.add.reduce(sorted[indexer] * weights,
axis=axis) / sumval

这是一个可重复的例子:

import numpy as np 
import pandas as pd 
import random

import seaborn as sns

kde_data = np.random.normal(loc=0.0,scale=1,size=100) # fake data
kde_data = pd.DataFrame(kde_data)
kde_data.columns = ["value"]
#kde_data.head()

现在,情节是正确的,但我继续得到上面的警告并使用arr [tuple(seq)]而不是arr [seq]对我没什么帮助.

sns.distplot(kde_data.value,hist=False,kde=True)

enter image description here

我正在研究Jupyter,这是模块版本:

seaborn==0.9.0
scipy==1.1.0
pandas==0.23.0
numpy==1.15.4

解决方法

你没有做错任何事.目前除了可能的 suppressing it之外,没有办法摆脱这个警告.

这告诉你的是seaborn使用scipy函数,由于最近numpy版本的更改,将来会改变行为.我期望在这里发生的是,在未来的scipy版本中,该功能将被改变以适应任何过去未来的numpy版本.在此之前,您可能只是决定接受警告.它不会以任何方式恶化绘图结果.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读