np unique python

没有找到与「np unique python」相关的内容

AI 回答 由 glm-4-flash 生成 · 仅供参考,请自行核实
1. `np.unique` 函数用于返回输入数组的唯一值。
2. 返回值包括两个数组:一个是唯一值,另一个是唯一值在原数组中的索引。
3. 示例代码:```python
import numpy as np
arr = np.array([1, 2, 2, 3, 4, 4, 4])
unique_values, indices = np.unique(arr, return_index=True)
print(unique_values) # 输出:[1 2 3 4]
print(indices) # 输出:[0 1 3 5]
没有找到「np unique python」相关的内容

建议:检查关键词是否有错别字,或换一个更常见的说法。

相关搜索