摘要: import pandas as pdsimport numpy as np #数据读取df = pds.read_csv('D://try.csv', encoding='UTF-8')df = pds.read_table('D://try.txt')df = pds.read_table('D 阅读全文
posted @ 2019-07-04 17:30 really_really 阅读(226) 评论(0) 推荐(0) 编辑
摘要: # 不带参数的函数 def printLine(): #输出一条横线 print(" "); #没有返回值 #return; printLine(); # 带参数的函数def printInfo(name, age): print("name is: ", name, "; age is: ", a 阅读全文
posted @ 2019-07-03 16:01 really_really 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 注:axis = 0为行操作,axis = 1为列操作。 from pandas import DataFrame; df = DataFrame({ 'age': [21, 22, 23], 'name': ['KEN', 'John', 'JIMI']}); df = DataFrame(dat 阅读全文
posted @ 2019-07-03 15:35 really_really 阅读(224) 评论(0) 推荐(0) 编辑
摘要: from pandas import Series; #定义,可以混合定义x = Series(['a', True, 1], index=['first', 'second', 'third']);x = Series(['a', True, 1]); #访问x[1];#根据index访问x['s 阅读全文
posted @ 2019-07-03 15:12 really_really 阅读(255) 评论(0) 推荐(0) 编辑
摘要: % #与 | #或 not #非 #取整7 // 4 #求余10 % 4 #乘方2 ** 3 #一个关于浮点数运算需要注意的地方a = 4.2b = 2.1c = a + b # c = 6.300000000000001 from decimal import Decimala = Decimal 阅读全文
posted @ 2019-07-03 14:42 really_really 阅读(100) 评论(0) 推荐(0) 编辑
摘要: pycharm注释:Ctrl + /查看字符串方法:输入str,按住ctrl,点击 str.capitalize()#首字母大写 str.casefold()str.lower()#将大写字母变为小写,casefold有更多对应关系 str.center(width,'x')#将内容居中,两端用x补 阅读全文
posted @ 2019-06-20 21:25 really_really 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 特点:元素排列有序,可以被修改del list[a]#删除列表中的第a个元素 list[1][2][3]#多重索引 list.append()#只能追加一个参数到列表最后list.extend()#for循环将每一个参数用append方法追加到列表,参数为可迭代对象 list.clear()#清空列 阅读全文
posted @ 2019-06-20 21:25 really_really 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 元组特点:有序,一级元素不能被修改,不能增删元素#一般写元组时,推荐在最后加, 可以被for循环,可迭代对象 字典特点:无序,支持 del 删除两个键值对,键重复,则只保留一个键值对字典的value可以是任意值元组,布尔值可作为列表的key,列表、字典不可 dict.keys()dict.value 阅读全文
posted @ 2019-06-20 21:25 really_really 阅读(140) 评论(0) 推荐(0) 编辑