How to find most frequent values in numpy ndarray?

前端 未结 5 2167
栀梦
栀梦 2020-12-15 05:38

I have a numpy ndarray with shape of (30,480,640), the 1th and 2th axis representing locations(latitude and longitute), the 0th axis contains actual data points.I want to us

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 06:24

    flatten your array, then build a collections.Counter from it. As usual, take special care when comparing floating-point numbers.

提交回复
热议问题