I'm running the following code on two different machines:
import pandas as pd
import numpy as np
# compute ids
coeff = np.dot(matrix1, np.transpose(matrix2))
where matrix2
is a pandas dataframe.
They are both running version 4.0.6
of Anaconda. One is Ubuntu 16 the other is OSX. Under OSX the code runs just fine. Under Linux, I'm getting
TypeError: transpose() takes exactly 1 argument (2 given)
Numpy version is 1.10.4
in both cases. The error above is fixed with the following change:
coeff = np.dot(matrix1, np.transpose(matrix2.as_matrix()))
why?
Copyright Notice:Content Author:「Bob」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37516731/different-behavior-of-numpy-transpose-with-ubuntu-vs-osx