記事一覧表示

seaborn.distplot()を使ったらFutureWarningを吐かれた話

 seabornのdistplot()関数を使った時に以下のようなWarningを吐かれた。

***/scipy/stats/stats.py: 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

 「予期しない動作とかエラーを吐く可能性があるからstats.pyに入れるarrayのindexはtupleを使用して欲しい」とかそんな感じの事が書いてあるけど、正直良く分からん…
 調べてみるseaborn.distplot は、裏で scipy.stats を呼び出していて、そこでWarningを吐くんだけど、解決策が

For python>=3.7 you need to upgrade your scipy>=1.2.

だったので、ひとまず、

% conda update conda
% conda update --all

でconda内のパッケージをアップデートしたら直りました。
技術者の方に感謝m(_ _)m