摘要: import pandas as pd students1 = pd.read_csv('C:/Temp/Students.csv', index_col='ID') students2 = pd.read_csv('C:/Temp/Students.tsv', sep='\t', index_col='ID') students3 = pd.read_csv('C:/Temp/Student... 阅读全文
posted @ 2019-06-21 20:58 Inserence 阅读(1237) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd pd.options.display.max_columns = 999 videos = pd.read_excel('C:/Temp/Videos.xlsx', index_col='Month') # table = videos.transpose() table = videos.T print(table) 阅读全文
posted @ 2019-06-21 20:56 Inserence 阅读(211) 评论(0) 推荐(0) 编辑
摘要: import pandas as pdstudents = pd.read_excel('D:/Temp/Students.xlsx',index_col='ID')temp = students[['Test_1','Test_2','Test_3']]row_sum = temp.sum(axi 阅读全文
posted @ 2019-06-20 21:01 Inserence 阅读(243) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd employees = pd.read_excel('D:/Temp/Employees.xlsx',index_col='ID') df = employees['Full Name'].str.split(expand = True) #expand 分成2列 employees['Firest Name'] =df[0] employees['L... 阅读全文
posted @ 2019-06-19 21:02 Inserence 阅读(455) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd def score_valication(row): try: assert 0 <= row.Score <= 100 except: print(f'#{row.ID}\tstudent {row.Name} has an invalid score {row.Score}') students ... 阅读全文
posted @ 2019-06-19 20:26 Inserence 阅读(165) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import matplotlib.pyplot as plt weeks=pd.read_excel('c:/Temp/Orders.xlsx',index_col='Week') print (weeks) print(weeks.columns) weeks.plot.area(y=['Accessories','Bikes','Clothin... 阅读全文
posted @ 2019-06-11 12:00 Inserence 阅读(334) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import matplotlib.pyplot as plt students=pd.read_excel('c:/Temp/Students.xlsx',index_col='From') print(students) students['2017'].plot.pie(fontsize=8,counterclock=False,startang... 阅读全文
posted @ 2019-06-10 15:58 Inserence 阅读(125) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import matplotlib.pyplot as plt users=pd.read_excel('c:/Temp/Users.xlsx') users['Total'] = users['Oct']+users['Nov'] + users['Dec'] #创建Total列 users.sort_values(by = 'Total',inpl... 阅读全文
posted @ 2019-06-10 15:20 Inserence 阅读(469) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import matplotlib.pyplot as plt students=pd.read_excel('c:/Temp/Students.xlsx') students.sort_values(by = 'Number',inplace= True ,ascending= False) #sort_values 排序 #以Numberi排序 ... 阅读全文
posted @ 2019-06-10 00:35 Inserence 阅读(157) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd def age_18_to_30(a): return 18<=a<30 def level_a(s): return 85<=s<=100 students=pd.read_excel('c:/Temp/Students.xlsx',index_col = 'ID') students=students.loc[students.Age... 阅读全文
posted @ 2019-06-10 00:04 Inserence 阅读(230) 评论(0) 推荐(0) 编辑