LoginSignup
2
1

More than 3 years have passed since last update.

PythonのNaNに関する注意事項

Posted at

概要

これでハマったのでメモ

現象

あるリストの中の値の最大値、最小値を取得する時に発生

> import numpy as np
> max([1, 2, np.nan])
2

これは至極当然

> max([np.nan, 1, 2])
nan

!?

というわけで、先頭が異なるだけで結果が異なりますので注意

2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1