Numpy 的 tile(~)
方法通過重複輸入數組指定的次數來返回一個新的 Numpy 數組。
參數
1. a
| array-like
輸入數組。
2. reps
| array-like
所需的重複次數 a
。
返回值
如果 a
是標量,則返回標量。否則,返回一個 Numpy 數組。
例子
基本用法
np.tile([3,4], 2)
array([3, 4, 3, 4])
np.tile([5,6], [2,3])
array([[5, 6, 5, 6, 5, 6],
[5, 6, 5, 6, 5, 6]])
在這裏,我們按行重複數組[5,6]
兩次,按列重複三次。
相關用法
- Python time.tzname()用法及代碼示例
- Python time.monotonic()用法及代碼示例
- Python time.tzset()用法及代碼示例
- Python time.asctime()用法及代碼示例
- Python time ctime()用法及代碼示例
- Python time.daylight()用法及代碼示例
- Python time.perf_counter()用法及代碼示例
- Python time mktime()用法及代碼示例
- Python time.get_clock_info()用法及代碼示例
- Python time.process_time_ns()用法及代碼示例
- Python time localtime()用法及代碼示例
- Python time.gmtime()用法及代碼示例
- Python time sleep()用法及代碼示例
- Python time.strptime用法及代碼示例
- Python timeit.Timer.print_exc用法及代碼示例
- Python time.time()用法及代碼示例
- Python time.mktime()用法及代碼示例
- Python time.sleep()用法及代碼示例
- Python time.thread_time()用法及代碼示例
- Python time.strftime用法及代碼示例
- Python time.clock_gettime_ns()用法及代碼示例
- Python time.tzset用法及代碼示例
- Python time.monotonic_ns()用法及代碼示例
- Python time.perf_counter_ns()用法及代碼示例
- Python time.time_ns()用法及代碼示例
注:本文由純淨天空篩選整理自Isshin Inada大神的英文原創作品 NumPy | tile method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。