我已经搜索了 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/