python - future 警告 : Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]`

标签 python python-3.x pandas scipy seaborn

我已经搜索了 S/O,但找不到答案。

当我尝试使用 seaborn 绘制分布图时,我收到了一个 future 警告。我想知道这里可能是什么问题。

import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
% matplotlib inline
from sklearn import datasets

iris = datasets.load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
df['class'] = iris.target
df['species'] = df['class'].map({idx:s for idx, s in enumerate(iris.target_names)})


fig, ((ax1,ax2),(ax3,ax4))= plt.subplots(2,2, figsize =(13,9))
sns.distplot(a = df.iloc[:,0], ax=ax1)
sns.distplot(a = df.iloc[:,1], ax=ax2)
sns.distplot(a = df.iloc[:,2], ax=ax3)
sns.distplot(a = df.iloc[:,3], ax=ax4)
plt.show()

这是警告:

C:\ProgramData\Anaconda3\lib\site-packages\scipy\stats\stats.py:1713:
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

有什么帮助吗?你可以运行上面的代码。你会收到警告。

Pandas :0.23.4,seaborn:0.9.0,matplotlib:2.2.3,scipy:1.1.0 , numpy: 1.15.0'

最佳答案

对于 python>=3.7,您需要升级您的 scipy>=1.2

关于python - future 警告 : Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]` ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52594235/

相关文章:

python - DataFrame中列之间的相关性

python - 重命名 pandas 数据框的第一行

python - 切片正在向我的阵列添加第三维 - 不知道为什么

python - 如何调整seaborn中的子图大小?

python - 安装 tfprof 命令行

python - cumcout groupby --- 如何按组列出

python - 在导入前一个类的类中导入一个类(import-ception)

Python 3 - 用下一个字母检查字符串中的字母

python - apply() 函数和使用类对象的函数调用有什么区别?

python - findAll-beautifulsoup-python 无法正常工作