當前位置: 首頁>>代碼示例 >>用法及示例精選 >>正文


Python numpy.flipud()用法及代碼示例


關於:
numpy.flipud(array):沿up-down方向的翻轉數組(每列中的條目),保留形狀
參數:

array : [array_like]Input array, we want to flip

返回:

Flipped array in up-down direction.
# Python Program illustrating 
# numpy.flipud() method 
  
import numpy as geek 
  
array = geek.arange(8).reshape((2,2,2)) 
print("Original array : \n", array) 
  
# flipud : means flip up-down 
print("\nFlipped array : \n", geek.flipud(array))

輸出:


Original array : 
 [[[0 1]
  [2 3]]

 [[4 5]
  [6 7]]]

Flipped array : 
 [[[4 5]
  [6 7]]

 [[0 1]
  [2 3]]]

參考文獻:
https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.flipud.html#numpy.flipud



相關用法


注:本文由純淨天空篩選整理自 numpy.flipud() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。