Let's assume I have two variables whose content is very big, and so I'm not interested in checking manually their content.
For a working example purpose, let's run:
from sklearn.datasets import fetch_openml
mnist=fetch_openml('mnist_784',version=1)
mnist2=minst
I have no idea what's in mnist. If I do type(mnist)
, I get sklearn.utils.Bunch
which for me means nothing...
I'm looking for a method, or function, that tells me if two variables (mnist and mnist2) are equal to each other, i.e. function(mnist,mnist2)
returns True
. I don't want a method/function that works only when the variables are strings, or only when they are lists... I'm looking for a method/function that works even when I have no idea what the variable content is, just like above.
For example, I've used == for comparing two variables, but I get an error.
ValueError Traceback (most recent call last)
<ipython-input-9-582032dfa1c5> in <module>
----> 1 mnist==mnist2
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
So, I've tried
import numpy
numpy.all(mnist==mnist2)
which returns
ValueError Traceback (most recent call last)
<ipython-input-21-c2fa07d03d32> in <module>
1 import numpy
----> 2 numpy.all(mnist==mnist2)
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()