numpy adds dimensions to array np. instances of newaxis

  • 2021-01-18 06:34:35
  • OfStack

This is as follows:


a[:, np.newaxis] #  to a Each in the outermost bracket 1 An element to add []
a[np.newaxis, :] #  to a All the elements in the outermost brackets are plus []

Related articles: