Inconsistent Results - Jupyter Numpy & Transpose
NickName:Master-P Ask DateTime:2019-03-22T04:39:40

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 notebooks, it does.

I have an example where it is inconsistent, and I do not understand:

Please see the picture attached of my jupyter notebook if 2 more or less identical arrays with 2 different outputs.

It seems it IS and IS NOT transposing the 1D array. Inconsistency is bad

outputs is (1000,) and (1,1000), why does this occur?

# GENERATE WAVEORM:
#---------------------------------------------------------------------------------------------------
N   = 1000
fxc = []
fxn = []
for t in range(0,N):
    fxc.append(A1*m.sin(2.0*pi*50.0*dt*t) + A2*m.sin(2.0*pi*120.0*dt*t))
    fxn.append(A1*m.sin(2.0*pi*50.0*dt*t) + A2*m.sin(2.0*pi*120.0*dt*t) + 5*np.random.normal(u,std,size=1))
#---------------------------------------------------------------------------------------------------


# TAKE TRANSPOSE:
#---------------------------------
fc = np.transpose(np.array(fxc))
fn = np.transpose(np.array(fxn))
#---------------------------------


# PRINT DIMENSION:
#---------------------------------
print(fc.shape)
print(fn.shape)
#---------------------------------   

Copyright Notice:Content Author:「Master-P」,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/55288904/inconsistent-results-jupyter-numpy-transpose

More about “Inconsistent Results - Jupyter Numpy & Transpose” related questions

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

Numpy random seed valid for entire jupyter notebook

I'm using functions from numpy.random on a Jupyter Lab notebook and I'm trying to set the seed using numpy.random.seed(333). This works as expected only when the seed setting is in the same noteboo...

Show Detail

Learning: KMeans clustering inconsistent results

Learning ML and I'm new to KMeans clustering. How do I know if my model is accurate with the consistently inconsistent results that I'm getting? What I mean by consistently inconsistent is I get the

Show Detail

Jupyter not recognising numpy (using homebrew pyenv)

I followed these instructions to get a python virtual environment (managed by pyenv) working in a Jupyter Notebook. In summary, I did brew install pyenv pyenv install 3.8.5 pyenv virtualenv 3.8.5

Show Detail

Inconsistent results on Jupyer notebook and Intellij IDE: Python

I am trying to compute medcouple using robustats module in python. https://github.com/FilippoBovo/robustats The results on jupyter note book and IntelliJ Ide do not match. Result on my jupyter note...

Show Detail

Numpy and Pandas Not Working in Jupyter Notebook on Mac

I have both Python 2.7 and 3.6 working on my machine. Numpy and Pandas both load, for either version of Python, in the terminal. However, when I try to access them from inside Jupyter notebook, I g...

Show Detail

cannot import numpy 1.22.3 in jupyter_notebook

I can not import numpy in jupyter notebook, I tried pip uninstall numpy pip install numpy / but the problem is the same, numpy is working on visual studio code but it not in jupyter also pandas,the...

Show Detail

Failing to import numpy in Jupyter

First bear with me as I am relatively new to coding. I am trying to import numpy to Jupyter (localhost, webbased) using Python 3 and getting an error. import numpy as np ModuleNotFoundError Traceb...

Show Detail

Inconsistent module location in python and jupyter notebook

Because of the incompatibility between the Apple's new M1 chip and TensorFlow in Python, I followed some online guides to create an environment under Miniforge3 (so that we can run the python in the

Show Detail

Numpy will load in Jupyter but not in cmd/IDLE

I recently installed Anaconda and have some problem loading the numpy. When using Jupyter, there is no error. But I am trying to figure out how to make it also work with IDLE or when running a script

Show Detail