numpy repeat
时间: 2023-10-06 10:06:09 浏览: 129
Numpy中的repeat函数用于将数组中的元素重复指定的次数。它有两种使用方法:numpy.repeat(a, repeats, axis=None)和object(ndarray).repeat(repeats, axis=None)。\[1\]\[2\]其中,a表示输入的数组,repeats表示重复的次数,可以是一个整数或一个整数数组,axis表示重复的轴方向,当axis=0时,沿着y轴复制,实际上增加了行数;当axis=1时,沿着x轴复制,实际上增加了列数;当axis=None时,会将当前矩阵展平,实际上变成了一个行向量。\[3\]
#### 引用[.reference_title]
- *1* *2* [Numpy攻略系列:repeat函数](https://blog.csdn.net/u010496337/article/details/50572866)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [Python中numpy_repeat()函数](https://blog.csdn.net/sunny_qwq/article/details/123262086)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文