Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

RuntimeWarning: invalid value encountered in true_divide

import numpy as np

# define 2 NumPy arrays
a = np.array([8, 2, 9, 0])
b = np.array([4, 2, 3, 0])

# ignore the invalid warning message
np.seterr(invalid='ignore')

# divide both the numpy arrays
print(np.divide(a, b))
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #invalid #encountered
ADD COMMENT
Topic
Name
5+8 =