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)#如下图所示

  • 相关阅读:
    MD5加密 + 盐
    SQLite数据库--C#访问加密的SQLite数据库
    SQLite问题笔记
    微信开发--Two.菜单生成
    NOIP2018游记(更新完毕)
    HNOI2019 游记
    JXOI2017-2018 解题报告
    网络流20+4题解题报告(已更前20题)
    CodeForces528A (STLset)
    CodeForces 140C New Year Snowmen(堆)
  • 原文地址:https://www.cnblogs.com/liuting1990/p/7782668.html
Copyright © 2011-2022 走看看