06 2019 档案
摘要: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...
阅读全文
摘要: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)
阅读全文
摘要: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
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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排序 ...
阅读全文
摘要: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...
阅读全文
摘要:import pandas as pd products = pd.read_excel('c:/Temp/List.xlsx',index_col = 'ID') products.sort_values(by =['Worthy','Price'],inplace=True,ascending=[True,False] ) #sort_values 数据排序 ...
阅读全文
摘要:import pandas as pd books = pd.read_excel('e:/Books.xlsx',index_col='ID') for i in books.index: books['Price'].at[i]=books['ListPrice'].at[i]*books['Discount'].at[i] print(books) import pan...
阅读全文

浙公网安备 33010602011771号