[numpy]split()和array_split()
2016-07-20 14:56
585 查看
概述:
可以用于把narray分成几份。示例:
numpy.plit(ary, indices_or_sections, axis=0)>>> x = np.arange(9.0) >>> np.split(x, 3) [array([ 0., 1., 2.]), array([ 3., 4., 5.]), array([ 6., 7., 8.])] >>> x = np.arange(8.0) >>> np.split(x, [3, 5, 6, 10]) [array([ 0., 1., 2.]), array([ 3., 4.]), array([ 5.]), array([ 6., 7.]), array([], dtype=float64)]
numpy.array_split(ary, indices_or_sections, axis=0)
功能与split一样,唯一的区别是 array_split allows indices_or_sections to be an integer that does not equally divide the axis. >>> x = np.arange(8.0) >>> np.array_split(x, 3) [array([ 0., 1., 2.]), array([ 3., 4., 5.]), array([ 6., 7.])]
参考:
split():http://docs.scipy.org/doc/numpy/reference/generated/numpy.split.htmlarray_aplit():http://docs.scipy.org/doc/numpy/reference/generated/numpy.array_split.html
相关文章推荐
- 利用Python和OpenCV库将URL转换为OpenCV格式的方法
- Python NumPy库安装使用笔记
- Python中的Numpy入门教程
- #numpy#关于数组形状
- Python 排列组合以及多维数组排序
- NumPy基础(一)
- 安装numpy matplotlib
- python+numpy+scipy=matlab,抛弃matlab
- Python安装matplotlib所需要的软件以及问题的解决方法
- 例2.1.1的Numpy实现
- matplotlib初试——求两条直线相交的大概位置
- 绘制弹性模量的变化
- theano学习札记
- ParaView - Mixing NumPy and VTK APIs with high efficient using Python Programmable filter
- 开始正式写博客的第一天
- 新手学NumPy
- 创建视图和副本
- 来自bit.ly的1.usa.gov数据
- numba版 自适应差分进化算法 速度超快 可以求解约束问题
- windows下安装Python以及numpy、scipy、scitik-learn模块(3.4版本)