Answers for "np.random matrix"

2

random matrix python

np.random.rand(3,2)
Posted by: Guest on March-21-2020
1

numpy generate random 2d array

import numpy as np
a=np.random.rand(3,3)
print(a)
Posted by: Guest on November-07-2020
0

numpy randn with a shape of another array

a = np.zeros([2, 3])
print(a.shape)
# outputs: (2, 3)
b = np.random.randn(*a.shape)
print(b.shape)
# outputs: (2, 3)
Posted by: Guest on December-17-2020
0

np.random.rand()

# train test split
df = pd.read_csv('file_location')
mask = np.random.rand(len(df)) < 0.8
train  = df[mask]
test = df[~mask]
Posted by: Guest on March-04-2021

Python Answers by Framework

Browse Popular Code Answers by Language