Create Empty Np Array Code Example


Example 1: numpy empty array


import numpy as np

n = 2
X = np.empty(shape=[0, n])

for i in range(5):
for j in range(2):
X = np.append(X, [[i, j]], axis=0)

print X

Example 2: declare empty array of complex type python


numpy.empty(shape, dtype=float, order='C')

Example 3: create empty numpy array


>>> np.empty([2, 2])
#Output:
array([[ -9.74499359e+001, 6.69583040e-309],
[ 2.13182611e-314, 3.06959433e-309]])

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android SDK Location Should Not Contain Whitespace, As This Cause Problems With NDK Tools