Numpy.reshape

YJ·2023년 6월 6일
0

[제로베이스 데이터 취업 스쿨]

머신러닝 과정에서 이해가 잘 안됐던 numpy의 reshape에 대해 알아보았다.

numpy.shape: Return the shape of an array
numpy.reshape: Gives a new shape to an array without changing its data

[출처]: NumPy documentation(https://numpy.org/doc/stable/index.html)

  • reshape(-1, 정수n): 열의 개수 n개, 행의 개수는 자동으로 맞춰준다.
  • reshape(정수m, -1): 행의 개수 m개, 열의 개수는 자동으로 맞춰준다.
  • reshape(-1): 1차원 배열로 바꿔준다.

0개의 댓글