2021年10月14日木曜日

【matplotlib】FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated

matplotlibでグラフ表示をさせていたところ以下の警告メッセージ

FutureWarning: Support for multi-dimensional indexing (e.g. `obj[:, None]`) is deprecated and will be removed in a future version.  Convert to a numpy array before indexing instead.

どうやら非推奨な使い方?をしているようです。

グラフデータに<class 'pandas.core.indexes.datetimes.DatetimeIndex'>や<class 'pandas.core.series.Series'>型のデータを渡しているだけなのですが・・・。

【Version】
matplotlib:3.0.2
pandas:1.3.3
numpy:1.21.2

色々調べて結局valuesかto_numpy()で<class 'numpy.ndarray'>型に変換して渡すことで解決できました。(valuesよりto_numpy()が推奨されているらしい)

0 件のコメント:

コメントを投稿