Advertisement

Python基础学习Numpy

阅读量:

1 基本操作

1.数组创建方法解析

复制代码
    import numpy as np # Shift + Enter
    
    
      
    
复制代码
    # 创建可以将Python,中list列表转换成NumPy数组
    l = [1,2,3,4,5]
    
    # NumPy数组
    nd1 = np.array(l) # 输入一部分arr + tab(命令中自动补全,按键) 代码提示,自动补全
    print(nd1)
    display(nd1) # 显示
    
    
      
      
      
      
      
      
      
    
复制代码
    [1 2 3 4 5]
    
    array([1, 2, 3, 4, 5])
    
    
      
      
      
    
复制代码
    nd2 = np.zeros(shape = (3,4),dtype = np.int16) # shift + tab提示方法的属性,使用
    nd2
    
    
      
      
    
复制代码
    array([[0, 0, 0, 0],
       [0

全部评论 (0)

还没有任何评论哟~