How to create a vector in NumPy

You can create a vector in NumPy with the following code. If you want to learn Python then I will highly recommend you to read This Book.

How to create a vector in NumPy
How to create a vector in NumPy

Horizontal Vector (Single Row)

import numpy as np

list = [11, 12, 13, 14]

a = np.array(list)

print(a)
[11 12 13 14]

Vertical Vector (Single Column)

import numpy as np

list = [[11],
        [12],
        [13],
        [14]]

b = np.array(list)

print(b)
[[11]
 [12]
 [13]
 [14]]

People are also reading:

Best Python Books

What is Computer Vision? Examples, Applications, Techniques

Top 10 Computer Vision Books with Python

Books for Machine Learning (ML)

Free Learning Resources

Leave a Comment

Your email address will not be published.