numpy

1.Numpy:
    (1)官网
        https://numpy.org/
    (1) what is numpy?
        The fundamental package for scientific computing with Python
    (2)multidimensional array object 【编程模型】
        1.arrays and matrices [数组和矩阵]
        2.可以用来 数组操作、矩阵操作、线下代数、sort、random 

2.体验:
    求多元一次方程:
        3x +y -2z = 5 
        x-y+4z = -2 
        2x +3z = 2.5 
        [0.5 4.5 0.5]
    # 把等式系数 抽象成 向量组

3.python list  vs  numpy arr  
python list:放不同数据类型的 元素 
numpy arr: 元素类型 必须统一
建议使用  numpy arr  比python list 效率高 【 numpy arr  底层代码使用 c 实现的】


4.如何创建 ndarray 
There are 6 general mechanisms for creating arrays:
    (1)Conversion from other Python structures (i.e. lists and tuples)
    (2)Intrinsic NumPy array creation functions (e.g. arange, ones, zeros, etc.)
    (3)Replicating, joining, or mutating existing arrays
    (4)Reading arrays from disk, either from standard or custom formats
    (5)Creating arrays from raw bytes through the use of strings or buffers
    (6)Use of special library functions (e.g., random)
NumPy arrays:
    (1)ndarray  n N维数组对象
    (2)【元素数据类型必须相同】

创建一维数组:
    (1)数据类型转化
    (2)内置函数

创建二维数组:
    (1)数据类型转化
    (2)内置函数

5.数组属性: 
    (1)修改 sharp 
    (2)转换数据类型: 
        1.nparr =》 python 
        2.nparr元素 int =》 float

6.数组拼接与切片: 

7.数组的轴 (axis)
    (1)numpy 轴 可以理解为方向 
    (2)数组 0 1 2 表示
        eg :
            一维数组:只有一个 0 轴
            二维数组:0轴 1轴
            三维数组:0轴 1轴 2轴
    (3)轴 用于计算:(二维、三维)
        按照 0、1、2轴进行计算

8.数组的计算:(和矩阵差不多)
    1.数组与数的计算
    2.形状相同的数组计算
    3.不同形状的数组 计算? 
    4.行数 或 列数相同的 一维数组 与 多维数组 进行计算

np.xxx()  api 
np.sum
np.mean...


9.数组中的空值 

10.数组的操作:

11.random 


        

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值