Numpy's Future Warning for Comparison of Ndarrays when Trying to Create a Numpy Structured Array

148 views Asked by At

When trying to create a numpy structured array with the code below:

import numpy as np
z = np.zeros([3,3], dtype=[("x",float)])
print(z)

I'm getting two Future Warnings:

sys:1: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
sys:1: FutureWarning: elementwise == comparison failed and returning scalar  instead; this will raise an error or perform elementwise comparison in the future.

I know about a stand off between Numpy and Python developers regarding the comparison of data types that led to this warning (as can be read here: FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison) but I'm wondering why this Warning is being raised if I'm not doing any comparison, just trying to create a structured array.

The numpy version in use is 1.21.2

0

There are 0 answers