How to create and initialize matrix with numpy in Python

1 Answer

0 votes
import numpy

arr = numpy.matrix(numpy.arange(10).reshape((2, 5)))

print(arr)


'''
run:

[[0 1 2 3 4] 
 [5 6 7 8 9]]

'''

 



answered Jan 21, 2019 by avibootz

Related questions

1 answer 161 views
1 answer 123 views
2 answers 160 views
1 answer 262 views
1 answer 152 views
...