随笔分类 - Python_数据分析
摘要: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
阅读全文
摘要:# 不带参数的函数 def printLine(): #输出一条横线 print(" "); #没有返回值 #return; printLine(); # 带参数的函数def printInfo(name, age): print("name is: ", name, "; age is: ", a
阅读全文
摘要:注:axis = 0为行操作,axis = 1为列操作。 from pandas import DataFrame; df = DataFrame({ 'age': [21, 22, 23], 'name': ['KEN', 'John', 'JIMI']}); df = DataFrame(dat
阅读全文
摘要:from pandas import Series; #定义,可以混合定义x = Series(['a', True, 1], index=['first', 'second', 'third']);x = Series(['a', True, 1]); #访问x[1];#根据index访问x['s
阅读全文
摘要:% #与 | #或 not #非 #取整7 // 4 #求余10 % 4 #乘方2 ** 3 #一个关于浮点数运算需要注意的地方a = 4.2b = 2.1c = a + b # c = 6.300000000000001 from decimal import Decimala = Decimal
阅读全文

浙公网安备 33010602011771号