'invalid value encountered in double_scalars' warning, possibly numpy 'invalid value encountered in double_scalars' warning, possibly numpy python python

'invalid value encountered in double_scalars' warning, possibly numpy


In my case, I found out it was division by zero.


It looks like a floating-point calculation error. Check the numpy.seterr function to get more information about where it happens.


Sometimes NaNs or null values in data will generate this error with Numpy. If you are ingesting data from say, a CSV file or something like that, and then operating on the data using numpy arrays, the problem could have originated with your data ingest. You could try feeding your code a small set of data with known values, and see if you get the same result.