Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if an object is an np.array()?

Tags:

python

arrays

I'm trying to build a code that checks whether a given object is an np.array() in python.

if isinstance(obj,np.array()) doesn't seem to work.

I would truly appreciate any help.

like image 745
Sam Avatar asked Dec 01 '25 06:12

Sam


1 Answers

isinstance(obj, numpy.ndarray) may work

like image 173
Kani Avatar answered Dec 03 '25 21:12

Kani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!