numpy.random.shuffle(x)的用法
2015-12-05 11:45
651 查看
numpy.random.shuffle(x)
Modify a sequence in-place by shuffling its contents.
Examples
>>>
This function only shuffles the array along the first index of a multi-dimensional array:
>>>
Modify a sequence in-place by shuffling its contents.
Parameters: | x : array_like The array or list to be shuffled. |
---|---|
Returns: | None |
>>>
>>> arr = np.arange(10) >>> np.random.shuffle(arr) >>> arr [1 7 5 2 9 4 3 6 0 8]
This function only shuffles the array along the first index of a multi-dimensional array:
>>>
>>> arr = np.arange(9).reshape((3, 3)) >>> np.random.shuffle(arr) >>> arr array([[3, 4, 5], [6, 7, 8], [0, 1, 2]])
相关文章推荐
- python基本 tuple
- Day-6
- python--字典排序
- windows下,在python中安装xgboost的简易方法,解决 error C3861: “sleep”: 找不到标识符”
- Python基本 list
- Python 列表(Lists)
- Python 字符串
- Python 数字
- Python continue 语句
- Python break 语句
- Python 循环语句
- PYTHON-基础-时间日期处理小结
- Python 条件语句
- Python基础(面向对象之封装与继承)
- python mmap使用记录
- Python机器学习:贝叶斯文本分类器
- Python基本 char和string
- 最全Pycharm教程(9)——创建并运行一个基本的Python测试程序
- Python 学习教程
- Python之冒泡算法