摘要: import numpy as np import matplotlib.pyplot as mp # 整理数据 n = 500 x, y = np.meshgrid(np.linspace(-3, 3, n), np.linspace(-3, 3, n)) # print(x) z = (1 - 阅读全文
posted @ 2019-08-09 12:00 一如年少模样 阅读(1590) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import matplotlib.pyplot as mp # 整理数据 n = 500 x, y = np.meshgrid(np.linspace(-3, 3, n), np.linspace(-3, 3, n)) # print(x) z = (1 - 阅读全文
posted @ 2019-08-09 11:25 一如年少模样 阅读(1200) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import matplotlib.pylab as mp values = [26, 17, 21, 29, 11] spaces = [0.05, 0.01, 0.01, 0.01, 0.01] labels = ['Python', 'JavaScript 阅读全文
posted @ 2019-08-09 10:49 一如年少模样 阅读(394) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import matplotlib.pyplot as mp # 设置中文字体 mp.rcParams['font.sans-serif'] = ['SimHei'] # mp.rcParams['axes.unicode_minus'] = False app 阅读全文
posted @ 2019-08-09 10:32 一如年少模样 阅读(6784) 评论(0) 推荐(0) 编辑
摘要: 闲着无聊,最近刚好看完scrapy框架,想着找个网站练练手,想来想去,把书中的360图片抓取拓展为批量抓取各版块图片,并分类保存,该网站为动态加载网站(Ajax),基本上没有什么反爬措施,因此抓取起来很顺利。这个小项目重点在于重写图片保存路径,各模块代码具体为: 1、items.py 2、image 阅读全文
posted @ 2019-08-06 16:14 一如年少模样 阅读(1005) 评论(0) 推荐(0) 编辑
摘要: ''' 转换数据 ''' import pandas as pd df = pd.DataFrame([ ['green', 'M', '10.2', 'class1'], ['red', 'L', '13.5', 'class2'], ['blue', 'XL', '15.3', 'class1'], ]) df.columns = ['color 阅读全文
posted @ 2019-08-02 13:59 一如年少模样 阅读(198) 评论(0) 推荐(0) 编辑
摘要: ''' 数据的清洗 1.检测与处理重复值 2.检测与处理缺失值 3.检测与处理异常值 ''' import numpy as np import pandas as pd # 去重:按照A列去重,同时保留第一个数据且在原表去重 data = pd.DataFrame({'A': [1, 1, 2, 2], 'B':... 阅读全文
posted @ 2019-08-02 08:57 一如年少模样 阅读(571) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import pandas as pd df1 = pd.DataFrame(np.ones((3, 4)) * 0, columns=['a', 'b', 'c', 'd']) df2 = pd.DataFrame(np.ones((3, 4)) * 1, columns=['a', 'b', 'c', 'd']) df3 = pd.DataFrame(... 阅读全文
posted @ 2019-08-02 07:40 一如年少模样 阅读(1477) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import warnings warnings.filterwarnings('ignore') # 读取用户表 users = pd.read_table('./users.dat', header=None, names=['UserID', 'Gender', 'Age', 'Occupation', 'Zip-code'], sep='::'... 阅读全文
posted @ 2019-07-29 22:10 一如年少模样 阅读(588) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import pandas as pd df = pd.DataFrame({'key1': ['a', 'a', 'b', 'b', 'a'], 'key2': ['one', 'two', 'one', 'two', 'one'], 'data1': np.random.ran... 阅读全文
posted @ 2019-07-29 21:00 一如年少模样 阅读(791) 评论(0) 推荐(0) 编辑