在 seaborn 中使用 distplot 进行 FutureWarning
FutureWarning with distplot in seaborn
每当我尝试使用 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()
现在,情节是正确的,但我一直得到上面的 warning
并使用 arr[tuple(seq)]
而不是 arr[seq]
对我没有太大帮助。
sns.distplot(kde_data.value, hist=False, kde=True)
我正在研究 Jupyter,这是模块版本:
seaborn==0.9.0
scipy==1.1.0
pandas==0.23.0
numpy==1.15.4
你没有做错任何事。目前没有办法摆脱这个警告,除了可能 suppressing it.
这告诉你的是,seaborn 使用了一个 scipy 函数,由于在最近的 numpy 版本中所做的更改,该函数将在未来改变行为。我希望在这里发生的是,在未来的 scipy 版本中,该功能将被更改为与未来任何过去的 numpy 版本很好地配合使用。在那之前,您可能只是决定接受警告。它不会以任何方式恶化绘图结果。
在 中,他们指出这是 scipy 的问题,升级到 scipy>=1.2 应该可以解决问题。
每当我尝试使用 seaborn
中的 distplot
时,我都会收到此警告,而且我似乎无法弄清楚我做错了什么,抱歉,如果它很简单。
警告:
FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use
arr[tuple(seq)]
instead ofarr[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()
现在,情节是正确的,但我一直得到上面的 warning
并使用 arr[tuple(seq)]
而不是 arr[seq]
对我没有太大帮助。
sns.distplot(kde_data.value, hist=False, kde=True)
我正在研究 Jupyter,这是模块版本:
seaborn==0.9.0
scipy==1.1.0
pandas==0.23.0
numpy==1.15.4
你没有做错任何事。目前没有办法摆脱这个警告,除了可能 suppressing it.
这告诉你的是,seaborn 使用了一个 scipy 函数,由于在最近的 numpy 版本中所做的更改,该函数将在未来改变行为。我希望在这里发生的是,在未来的 scipy 版本中,该功能将被更改为与未来任何过去的 numpy 版本很好地配合使用。在那之前,您可能只是决定接受警告。它不会以任何方式恶化绘图结果。
在