更全面的追溯将是很好的。我的猜测是,
seaborn.distplot使用
scipy.stats计算的东西。错误发生在
def _compute_qth_percentile(sorted, per, interpolation_method, axis): .... indexer = [slice(None)] * sorted.ndim ... indexer[axis] = slice(i, i + 2) ... return np.add.reduce(sorted[indexer] * weights, axis=axis) / sumval
因此,在最后一行中,该列表
indexer用于slice
sorted。
In [81]: x = np.arange(12).reshape(3,4)In [83]: indexer = [slice(None), slice(None,2)]In [84]: x[indexer]/usr/local/bin/ipython3:1: 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. #!/usr/bin/python3Out[84]: array([[0, 1], [4, 5], [8, 9]])In [85]: x[tuple(indexer)]Out[85]: array([[0, 1], [4, 5], [8, 9]])
使用切片列表是可行的,但是计划将来会贬值。涉及多个维度的索引应该是元组。在上下文中使用列表是一种较旧的样式,正在逐步淘汰。
因此,
scipy开发人员需要解决此问题。这不是最终用户应该处理的事情。但是目前,不用担心
futurewarning。它不影响计算或绘图。有一种方法可以抑制将来的警告,但是我不知道这是不是可以立即使用的。
FutureWarning:不建议使用非元组序列进行多维索引编制,而应使用
arr [tuple(seq)]而非
arr[seq]


![FutureWarning:不推荐将非元组序列用于多维索引,请使用`arr [tuple(seq)]` FutureWarning:不推荐将非元组序列用于多维索引,请使用`arr [tuple(seq)]`](http://www.mshxw.com/aiimages/31/639093.png)
