Assumption University



0-19685Pandas??? Plot Graph ????????????? ??????????? Data Visualization ?????????00Pandas??? Plot Graph ????????????? ??????????? Data Visualization ???????????? Plot Graph ?????????????????????????????? ???????????????????????????????????? ???????????????????????????????????????? DataFrames ?? Pandas ???????????????????????? df (??????????????????????????????????????????? DataFrames ??????? zoo ???? zoo_eat ???????)import pandas as pddf = pd.DataFrame({ 'name':['john','mary','peter','jeff','bill','lisa','jose'], 'age':[23,78,22,19,45,33,20], 'gender':['M','F','M','M','M','F','M'], 'state':['california','dc','california','dc','california','texas','texas'], 'num_children':[2,0,0,3,2,1,4], 'num_pets':[5,1,0,5,2,2,3]})????????????????????????????????????????? ???????? df ?? run ??????????????????????????? ??????????????????? (????????????????? 6 columns ??? index ???????? column)????? plot graph ???? Python ???? Modules ??????????????????????????? plot ?????? module ????????????????? matplotlib ??????????????????????????????????????????????? plot ???????????????????????????????????????????? (??????????????? plot ???? scatter plot ?????????????????????????????????????? ???????????????? ???????????? children ????????? ???? pets ????????????????????? ?????????? trend ??????????????????????????????????)?????????????????????????????? x ???? ‘age’ ??? plot ?????????????????????? plot ????????? bar ?????? x ???? ‘name’ ??? ??? y ???? ‘age’ (?????????????? ???????????????????????????????????????????)???????????????? kind = ‘barh’ ????????????????? x ??? y ?????? 4 ??? plot ?????????????????? plot ????????????????????????? ???? ????????????????? ???? ????????????????????????????????????????????????????????????????? plot ?????????????? scatter ??? ??????? ?????????????????? plot ???????? ??????????????????? plot ????????????? ???????????? ?????????????? argument ?????? matplotlib ???? ax = plt.gca() ?????? gca ???????? get current axis ?????????????? matplotlib ??????????????? plot ?????????????? plot ??????????????????????????????????????????? plt.savefig(‘??????????????????’) ??? plt.show()????????????????????????????????????????????????????????????????? plot ??? pie chart ???????????????????? ????????????????????????????????????? pie ??????????????????????? plot ???????? pie ??????????????????????? num_pets ??????????????? ???????????? legend ??????????????? index ?????????????????? ????????????????????????????? index ???????????????????????????????????????? (????????????????? pie ???? label ????????????????)?????????? legend ?????????????????????????????????? ???????????????? legend ??? ?????? argument ???????????????? legend = False????????????????? legend = False ???????? plot???????????? plot ??????????????????????????????? plot ?????????????? ????????????????????????????????? ???? ?? pie ???????????????????? ?????????????????????????????????????????????????????????? DataFrame ???????????? ?????????????? argument ???????????????????? table = df (df ??? ?????? DataFrame ????????????????? ????????????????????????????????????? zoo ?????? argument ????????????? table = zoo)???????????????? table = df (??????????????????????????????????????????????)???????????????????????????????????????????? figsize = (10,10) ??? 10 ??????????????????????????????????????????? ??????????????????????????????????????????????????? plot ?????????????????????????????????????????? .groupby() ???????????????????????? ???????????????? plot ???? ????????????????????????????????????????????????? ??????????? name ???? index ???????? unique ???????????????????????????????????????????????????????? pie????????????????????????? state ??? plot ?????????????? pie???????????????????? plot ??????? histogram ????????????? column ?? column ????? ????????????????????? column age ???????? plot ??? histogram ????? bin (????????) ??????? 5 ???? ???? 0-19, 20-39, … ??????????????????????????? bar ??????? 0.7 ????????????????????????????? ??????????????????????????????????????????? ????????????????? plot ?????????? num_children ??? num_pets???????????????????????? zoo ??? zoo_eats ????? merge ?????? ??? plot ???????????????? ? ??????????????? merge ?????? ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download