上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 97 下一页
摘要: 一、数组的拼接 1、水平拼接 a、格式 np.hstack((数组1, 数组2)) # 注意: 值是元祖 # 0轴长要相同 b、例子 import numpy as np arr1 = np.arange(0, 12).reshape(2, 6) arr2 = np.arange(12, 22).r 阅读全文
posted @ 2019-11-28 23:32 市丸银 阅读(351) 评论(0) 推荐(0)
摘要: 一、步骤 1、查找值 使用数组的索引和切片 2、修改值 直接赋值 例子 import numpy as np arr1 = np.arange(0, 24).reshape(4, 6) # 使用数组的索引和切片查找值,并修改值 arr1[:, 2:5] = 10 print(arr1) 二、查找值补 阅读全文
posted @ 2019-11-28 23:31 市丸银 阅读(965) 评论(0) 推荐(0)
摘要: 一、取行 1、单行 数组[index, :] # 取第index+1行 例子 import numpy as np arr1 = np.arange(0, 24).reshape(4, 6) # 取第2行数据 row1 = arr1[1, :] print(row1) 2、连续的多行 数组[star 阅读全文
posted @ 2019-11-28 23:29 市丸银 阅读(143) 评论(0) 推荐(0)
摘要: 一、CSV文件 CSV: Comma-Separated Value,逗号分隔值文件 显示:表格状态 源文件:换行和逗号分隔,逗号 列,换行 行 二、读取数据 1、方法 loadtxt(fname, dtype=float, delimiter=None, skiprows=0, usecols=N 阅读全文
posted @ 2019-11-28 23:27 市丸银 阅读(754) 评论(0) 推荐(0)
摘要: 一、数组和数的计算 数组和数计算,数组中的每个元素和数进行计算 1、加 import numpy as np arr1 = np.arange(12).reshape(3, 4) print(arr1) # 数组的每个元素和数进行加法运算 arr2 = arr1 + 2 print(arr2) 2、 阅读全文
posted @ 2019-11-28 23:25 市丸银 阅读(491) 评论(0) 推荐(0)
摘要: 一、基础知识 1、安装 conda install numpy 2、什么是numpy?Python中做科学计算的基础库,重在数值计算 二、创建数组 import numpy as np # 方式一 np.array([1, 2, 3, 4, 5]) # 方式二 np.array(range(5)) 阅读全文
posted @ 2019-11-28 18:03 市丸银 阅读(194) 评论(0) 推荐(0)
摘要: 一、特点 数据必须是原始数据不能经过处理,数据连续型,显示一组或多组分布数据 histogram 直方图 normed 定额 二、核心 hist(x, bins=None, normed=None) # x是需要统计的数据,类型:数组 # bins是组数, 组数 = (max(数组)- min(数组 阅读全文
posted @ 2019-11-27 23:35 市丸银 阅读(364) 评论(0) 推荐(0)
摘要: 一、特点 离散数据,数据之间没有直接的关系 二、分类 1、垂直条形图 bar(x, height, width=0.8) # x 为x轴 # height 为y轴 # width 为 条形图的宽度 例子 from matplotlib import pyplot as plt from matplo 阅读全文
posted @ 2019-11-27 23:32 市丸银 阅读(243) 评论(0) 推荐(0)
摘要: 一、特点 离散的数据,查看分布规律,走向趋势 二、使用 1、核心 plt.scatter(x, y) # x为x轴的数据,可迭代对象,必须是数字 # y为y轴的数据,可迭代对象,必须是数字 # x和y必须一一对应 2、例子 注意:在设置x轴或y轴刻度时,ticks和labes的值要一一对应 from 阅读全文
posted @ 2019-11-27 22:49 市丸银 阅读(185) 评论(0) 推荐(0)
摘要: 注意:绘图和设置x轴的刻度是相互独立的不相关的 官网:https://matplotlib.org/ 案例:https://matplotlib.org/3.1.1/gallery/index.html 一、安装 conda install matplotlib 二、作用 1.将数据可疏忽,更直观的 阅读全文
posted @ 2019-11-27 16:08 市丸银 阅读(180) 评论(0) 推荐(0)
上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 97 下一页