I read in a csv file and did some manipulations, and got an object x. When I use type(x), it returns numpy.matrixlib.defmatrix.matrix. I have never seen this type before and wondering if there is any difference between it and a commonly seen 'numpy matrix'. Thanks!
1 Answer
They are the same:
In [1]: import numpy as np
In [2]: np.matrix
Out[2]: numpy.matrixlib.defmatrix.matrix
In [3]: id(np.matrix)
Out[3]: 4300190472
In [4]: id(np.matrixlib.defmatrix.matrix)
Out[4]: 4300190472
In [5]: a = np.matrix([[1, 2], [3, 4]])
In [6]: type(a)
Out[6]: numpy.matrixlib.defmatrix.matrix
numpy.matrix is a more convenient name for numpy.matrixlib.defmatrix.matrix.