[PYTHON] About numpy.newaxis

Note that there was little information about Python's numpy.newaxis. The purpose is conversion to vertical vector. According to NumPy's Reference, it seems to be an alias for None, but I'm not sure why adding None to a slice increases the dimension. There wasn't.

import numpy as np

a = np.array([1,2,3,4,5])

b = a[:,np.newaxis]
print b # array([[1],[2],[3],[4],[5]])Outputs

c = a[:,None]
print c # array([[1],[2],[3],[4],[5]])Outputs

Recommended Posts

About numpy.newaxis
About LangID
About CAGR
About python-apt
About Permission
About requirements.txt
About locale
About permissions
About Opencv ②
About axis = 0, axis = 1
About Opencv ③
About import
About numpy
About pip
About Linux
About endian
About Linux
About import
About Opencv ①
About Linux
About Linux
About Linux ①
About cv2.imread
About _ and __
About wxPython
Notepad about TecoGAN
About python slices
Briefly about __name__
About python comprehension
About Docker Volume
[Linux] About export
About reference type
About the test
Learn about programming
About Flask customization
About variable scope. .. ..
About Python tqdm.
About python yield
Notes about with
About python, class
About Linear Models
About Go functions
About pandas describe
About Firestore timeout
About python inheritance
About python, range ()
About Confusion Matrix
[Linux] About PATH
About python decorators
Linux (about groups)
Note about awk
About python reference
About Bitnami Autostart
About Python decorators
About Milkcocoa SDK
Notes about pytorch
[Python] About multi-process
About Numpy broadcast
About symbolic links
Memorandum about validation
About Go Interface