上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 50 下一页
摘要: 学习自:pandas1.2.1documentation 0、常用 1)读写 ①从不同文本文件中读取数据的函数,都是read_xxx的形式;写函数则是to_xxx; ②对前n行感兴趣,或者用于检查读进来的数据的正确性,用head(n)方法;类似的,后n行,用tail(n)——如果不写参数n,将会是5 阅读全文
posted @ 2021-02-01 21:02 ShineLe 阅读(2929) 评论(0) 推荐(0)
摘要: a=np.arange(9).reshape(3,3) #a是一个3*3的array #array -> list l=a.tolist() [[0, 1, 2], [3, 4, 5], [6, 7, 8]] #list -> array b=np.array(l) array([[0, 1, 2] 阅读全文
posted @ 2021-02-01 13:11 ShineLe 阅读(3755) 评论(0) 推荐(0)
摘要: 学习自:NumPy 教程 | 菜鸟教程 官网:Numpy官方文档 1、简介 numpy主要用于数组计算,包含: 1)一个强大的N维数组对象ndarray 2)广播功能函数 3)整合 C/C++/Fortran代码的工具 4)线性代数、傅里叶变换、随机数生成等功能 numpy通常与scipy(scie 阅读全文
posted @ 2021-01-31 16:05 ShineLe 阅读(378) 评论(0) 推荐(0)
摘要: 0、运算符 in:检查字典中是否有某个key 'a' in {'a':1,'b':2} True 提取其中Key对应的Value: d={'1':'A','2':'B','3':'C'} d['2'] #'B' d.get('2') #'B' 1、方法: 方法 说明 dict.clear() 删除d 阅读全文
posted @ 2021-01-30 21:03 ShineLe 阅读(117) 评论(0) 推荐(0)
摘要: 1、List相关的操作符 操作符 说明 例子 * 重复,将List重复若干遍放到同一个List中 ['hi'] * 3 ['hi' , 'hi' , 'hi'] + 合并两个List(作用和append、extend类似) [1,2,3]+[4,5,6] [1,2,3,4,5,6] in 检查元素是 阅读全文
posted @ 2021-01-30 17:12 ShineLe 阅读(94) 评论(0) 推荐(0)
摘要: wordcloud官方文档 1、简介 wordcloud是优秀的词云展示的第三方库 2、导入模块 import wordcloud 3、wordcloud对象初始化 以下参数值均为官方文档给出的默认值 w=wordcloud.WordCloud( font_path=None, width=400, 阅读全文
posted @ 2021-01-30 14:37 ShineLe 阅读(700) 评论(0) 推荐(1)
摘要: import re def clean(line): pattern = re.compile(u'[^\u4e00-\u9fa5]') #中文的范围为\u4e00-\u9fa5 line = re.sub(pattern,'',line) #将其中所有非中文字符替换 return line wit 阅读全文
posted @ 2021-01-30 12:56 ShineLe 阅读(3564) 评论(0) 推荐(1)
摘要: collections是Python内建的一个集合模块,其中提供了许多有用的集合类: namedtuple:只有属性的简易类 deque:双向增删的List ChainMap:多个字典的链接 Counter:计数器 以及其他可以参考:10.8 模块:collections - ShineLe - 博 阅读全文
posted @ 2021-01-29 19:21 ShineLe 阅读(381) 评论(0) 推荐(0)
摘要: import xlwt import os def write_excel(words,filename): #写入Excel的函数,words是数据,filename是文件名 wb=xlwt.Workbook() sheet=wb.add_sheet('sheet1') attr=['词语','词 阅读全文
posted @ 2021-01-29 15:00 ShineLe 阅读(1037) 评论(0) 推荐(0)
摘要: 学习自:(7条消息) pip 常用命令及控制台怎么查看python 及pip 和已安装包版本号_peiwang245的博客-CSDN博客_查看pip版本 1、版本及升级 版本:pip -V 升级pip:pip install --upgrade pip 如果要指定为Python3的pip升级,则应写 阅读全文
posted @ 2021-01-28 23:14 ShineLe 阅读(227) 评论(0) 推荐(0)
上一页 1 ··· 34 35 36 37 38 39 40 41 42 ··· 50 下一页