Different behavior of numpy transpose() with Ubuntu vs OSX
NickName:Bob Ask DateTime:2016-05-30T10:03:57

Different behavior of numpy transpose() with Ubuntu vs OSX

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

More about “Different behavior of numpy transpose() with Ubuntu vs OSX” related questions

Different behavior of numpy transpose() with Ubuntu vs OSX

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...

Show Detail

np.transpose behavior different for different array constructions

I came across this weird behavior with np.transpose wherein it works differently when used on an numpy array and array constructed from a list. As an MWE following code is presented. import numpy a...

Show Detail

np.transpose() and np.reshape() combination gives different results in pure numpy and in numba

The following code produces different outputs: import numpy as np from numba import njit @njit def resh_numba(a): res = a.transpose(1, 0, 2) res = res.copy().reshape(2, 6) return res...

Show Detail

fft of numpy and octave different on transpose

First of i know there is an identical question with answer in SO here: FFT in Matlab and numpy / scipy give different results but the answer given there does not work on the test i did: when i do ...

Show Detail

Inconsistent Results - Jupyter Numpy & Transpose

enter image description here I am getting odd behavior with Jupyter/Numpy/Tranpose()/1D Arrays. I found another post where transpose() will not transpose a 1D array, but in previous Jupyter noteb...

Show Detail

python different import behaviour on osx and ubuntu

I have the same python project on 2 computers running osx and ubuntu 14.04 I am running a script in the phd_thesis.non_linear_features_selection folder At the beginning of the script I import some

Show Detail

Funky behavior with numpy arrays

Am hoping someone can explain to me the following behavior I observe with a numpy array: >>> import numpy as np >>> data_block=np.zeros((26,480,1000)) >>> indices=np.ara...

Show Detail

Numpy in VS Code Ubuntu 20.04

I am new to Ubuntu and is trying to get Numpy working on VS Code. Following is my code: import matplotlib.pyplot as plt import numpy as np x = [1,2,3,4] y = [3,5,7,9] plt.grid(True) plt.xlabel(&qu...

Show Detail

transpose function of numpy

I am new to numpy and python and I am trying to understand the usage of transpose function of numpy. The code below works fine but I am still not be able to understand the effect of transpose funct...

Show Detail

python numpy transpose not working as expected

I want to transpose a matrix by different means, and I am not successful. I first tried this import numpy as np z = self.mat print len(z), len(z[0]) print ' z ' + str(z) + ' ztr ' + s

Show Detail