![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据科学库
一个写bug的小仙女
这个作者很懒,什么都没留下…
展开
-
numpy学习(3)
读取文件# 读取数据us_file_path = "F:/code\Study/aiLearning/youtube_video_data/US_video_data_numbers.csv"uk_file_path = "F:/code\Study/aiLearning/youtube_video_data/GB_video_data_numbers.csv"t1 = np.loadtxt(us_file_path, delimiter=',', dtype='int')t2 = np.loa原创 2021-10-11 22:13:45 · 75 阅读 · 0 评论 -
numpy学习(4)
import numpy as npt1 = np.arange(12).reshape(3, 4).astype("float")t1[1, 2:] = np.nanprint(t1)# 用列均值替换nandef fill_nan(t1): for i in range(t1.shape[1]): # 遍历每一列 temp_col = t1[:, i] nan_num = np.count_nonzero(temp_col != temp_col)原创 2021-10-11 22:11:57 · 86 阅读 · 0 评论 -
numpy学习(3)
读取文件# 读取数据us_file_path = "F:/code\Study/aiLearning/youtube_video_data/US_video_data_numbers.csv"uk_file_path = "F:/code\Study/aiLearning/youtube_video_data/GB_video_data_numbers.csv"t1 = np.loadtxt(us_file_path, delimiter=',', dtype='int')t2 = np.load原创 2021-10-11 22:11:18 · 75 阅读 · 0 评论 -
numpy学习(2)
import numpy as npt1 = np.arange(12)print(t1.shape)t2 = t1.reshape(3, 4)print(t2)print(t2.shape)# [[[ 0 1 2 3]# [ 4 5 6 7]# [ 8 9 10 11]]## [[12 13 14 15]# [16 17 18 19]# [20 21 22 23]]]# 2 代表数据块,3 代表每一块的数据行;4 代表每一块的数据列t5 = np.a原创 2021-10-11 22:10:11 · 81 阅读 · 0 评论 -
numpy学习(1)
import randomimport numpy as np# 一维数组的三种创建方式t1 = np.array([1, 2, 3])print(t1)t2 = np.array(range(10))print(t2)t3 = np.arange(0, 10, 2)print(t3)print(type(t3))print(t3.dtype)# numpy中的数据类型t4 = np.array(range(1, 4), dtype="float32")print(t4)原创 2021-10-11 22:09:21 · 57 阅读 · 0 评论 -
matplotlib学习-直方图
from matplotlib import pyplot as plta = [131, 98, 125, 131, 124, 139, 131, 117, 128, 108, 135, 138, 131, 102, 107, 114, 119, 128, 121, 142, 127, 130, 124, 101, 110, 116, 117, 110, 128, 128, 115, 99, 136, 126, 134, 95, 138, 117, 111, 78, 132, 124, 11原创 2021-09-10 23:18:13 · 59 阅读 · 0 评论 -
matplotlib学习-柱状图
单一柱状图及横向柱状图from matplotlib import pyplot as pltfrom matplotlib import font_manager as fm# 加载本地中文字体my_font = fm.FontProperties(fname="C:\Windows\Fonts\simsun.ttc")a = ["战狼2","速度与激情8","功夫瑜伽","西游伏妖篇","变形金刚5:最后的骑士","摔跤吧!爸爸","加勒比海盗5:死无对证","金刚:骷髅岛","极限特工:终原创 2021-09-09 22:57:18 · 88 阅读 · 0 评论 -
matplotlib学习-散点图
# 加载本地中文字体my_font = fm.FontProperties(fname="C:\Windows\Fonts\simsun.ttc")y_3 = [random.randint(20, 35) for i in list(range(31))]y_10 = [random.randint(20, 35) for i in list(range(31))]x_3 = list(range(31))x_10 = list(range(51, 82))plt.figure(fi.原创 2021-09-09 22:55:02 · 70 阅读 · 0 评论 -
matplotlib学习-样式设置
import randomfrom matplotlib import font_manager as fmfrom matplotlib import pyplot as plt# 加载本地中文字体my_font = fm.FontProperties(fname="C:\Windows\Fonts\simsun.ttc")X = list(range(11, 31))Y_1 = [1, 0, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 5, 4, 3, 2,原创 2021-09-09 22:54:17 · 95 阅读 · 0 评论 -
matplotlib学习-折线图
常用方法总结plot 画图show 显示图片xticks 可以设置X轴的显示范围 其中 rotation 可以设置标注的倾斜度xlabel 设置x轴标题ylabel 设置y轴标题title 设置图形标题figure figureSize 设置图片大小savefig 保存图片 格式可以为png/svg…显示中文(见代码)`import randomfrom matplotlib import font_manager as fmfrom matplotlib import pyplo原创 2021-09-06 21:38:02 · 95 阅读 · 0 评论