zoukankan      html  css  js  c++  java
  • python numpy 包积累

    2017.11.4

    np.ptp(array)#最大值和最小值之间的差值,peak to peak

    np.array(data).flatten()#展平数据,http://www.cnblogs.com/itdyb/p/5796834.html

    np.ones(N, dtype=np.bool)

    http://www.mamicode.com/info-detail-992832.html

     2017.11.5

    1.np.linspace(startstopnum=50)#生成指定区间下指定区间个数的区间的两端,Return evenly spaced numbers over a specified interval.

      np.linspace(5,10,3)#http://blog.csdn.net/grey_csdn/article/details/54561796;https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html

      Out[71]: array([ 5. , 7.5, 10. ])

    2.np.meshgrid(x,y)#生成网格点,转载自http://www.cnblogs.com/sunshinewang/p/6897966.html

      #其主要作用是用于绘制形如x**2+y**2的函数图形,先为x变化,y不发生变化,例如咋x=-2,-1,0,1时y=1;然后依次进行下去

      #一般会使用plt.imshow()进行画图,横         纵坐标为数据的索引,颜色为值http://blog.csdn.net/shuke1991/article/details/50462580

      x = np.arange(-2,2); y = np.arange(0,3)

          z,s = np.meshgrid(x,y)

      z  

      array([[-2, -1, 0, 1],
      [-2, -1, 0, 1],
      [-2, -1, 0, 1]])

      s  

      array([[0, 0, 0, 0],
      [1, 1, 1, 1],
      [2, 2, 2, 2]])

      plt.scatter(z,s)#如下图所示

  • 相关阅读:
    pl2303 驱动
    tomcat 启动脚本
    Linux下Shell命令加减乘除计算
    定时删除文件夹"$1"下最后修改时间大于当前时间"$2"天的文件
    mysql 拼接字符
    jquery iframe父子框架中的元素访问方法
    在线工具
    js对数组对象的操作以及方法的使用
    HTML 设置字体
    10月1号 备忘录
  • 原文地址:https://www.cnblogs.com/liuting1990/p/7782668.html
Copyright © 2011-2022 走看看