'invalid value encountered in double_scalars' warning, possibly numpy

前端 未结 7 1308
一向
一向 2020-12-03 09:34

As I run my code I get these warnings, always in groups of four, sporadically. I have tried to locate the source by placing debug messages before and after certain statement

7条回答
  •  不知归路
    2020-12-03 10:16

    Zero-size array passed to numpy.mean raises this warning (as indicated in several comments).

    For some other candidates:

    • median also raises this warning on zero-sized array.

    other candidates do not raise this warning:

    • min,argmin both raise ValueError on empty array
    • randn takes *arg; using randn(*[]) returns a single random number
    • std,var return nan on an empty array

提交回复
热议问题