Assumption University



0-19685Pandas??? Plot Graph ????????????? ??????????? Data Visualization ?????? 200Pandas??? Plot Graph ????????????? ??????????? Data Visualization ?????? 2import 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]})????????????????????????????????????????? (????????? worksheet ???????) ???????? df ?? run ??????????????????????????? ??????????????????? (????????????????? 6 columns ??? index ???????? column)??? exercise ???????????????? ??????????? plot ??????? pie ????????? num_pets ???????? label ????????????????? ??????????????????????????????? pie ???? (???????????????????????????? worksheet4)???????????????????????????????? pie ??????????? ??????????????????????????????????????????????? pie (??????????????????) ??????????????????? argument ????????????????? plot ???????????? explode = (0,0.1,0,0,0,0) ??????????????????? explode ????????? ???????????????????? Mary (???????? explode ??????????????? .plot( ) )?????????????????????????? explode ????????????????????????? pie??????????? plot ???? pie ?????? num_children ????????????????????????????? jeff ??? jose ??? explode ??????????????????? plot ???? ?? worksheet ??????? ???????????? plot ???????????????? label ????? x ?????? y ????????? default ?????????????????????????????? ?????????????????????????? plot ??????? histogram ????????????????? ????????????????????????????????????????? label ????? x ??? y ????????????????????????????????????????????????????????????????????????????????????????? ???????????????????? plot ?????????????????????????????????? ax (????????????????????????????????????) ?????????????????????? .set( ) ?????????? title, lable ?????? x ??? y ???? ax.set(title = 'Histogram Graph', xlable = 'Range of Age', ylable = 'Number of People ') ?????????? pie ?????????????????????? title ??????????? Pets Owned by Each Person' ???????? label ????? y ???? Percentage of Pets'??????????????????????????????????????????????? scottish_hills.csv (??????????????? portal ???????????????? ?????????????????????????????????? ??????? ???????? (latitude) ??????? (longitude) ??????????????????????????????????) ???????? plot ??????? histogram ???????????? height (???????????????) ??????????? bin ???? 900,950,1000,1050,1100,1150,1200,1250,1300,1350 ?????? rwidth = 0.9 ??????????????????????????????????????????????????????????? title, label ????? x ??? y ????????????????????????????????????????????????????? scottish_hills.csv ????????????????????????? (latitude) ????????? plot ????????????????? Scotland ???????????? plot ??? scatter ?????????????????? label ??? x ??? y ?????????? column ???????????????? plot ???? plot ?????????????????????????????????? title ??????????????????? Mountains in Scotland ?????????? label ??? y ???? Mountain Height????? plot ?????????????????????????? ????????????? plot ????????????????????? ?????????????????plot ????????????????????????????? 1,200 ???? ???????????????????????????????ax = sh[sh.Height > 1200].plot(kind='scatter', x='Height',y='Latitude',figsize=(10,10))??? syntax ??? ?? dataframe ????????????? (???????????? sh) ???????????????????? [ ] ??? sh.Height > 1200 ?????????????????????? sh ?? column ??????? ??????????????????????? 1,200?????????????????????????????????? 1,100?????????????????????????????????? 57????????????????????????????????????????? ???? ??????? 900 ??????????? 1100 ???????????????????????????? sh[sh.Height > 900] ????????????????????????????? dataframe ??????????????? ????sh1 = sh[sh.Height > 900]????????????????????????????????????????? < 1100 ???????????????? dataframe ????????? ???? sh2 = sh1[sh1.Height < 1100] ???????????????? plot ????????????? dataframe ??????????????????????? plot ?????????????????????????? 1200 ??? 1300 ????????????????????????????????????????????????????? plot ???????????????????? (Latitude) ??????? 57 ??? 58??????????????????????? latitude ??? longitude ????????? plot ???????????????????????????? ?????? package cartopy ???????????????????????????????? ??????????????????????? command prompt conda install -c conda-forge cartopy????????? python code ???????? ?????????? plot import cartopy.crs as ccrsfrom cartopy.mpl.ticker import LongitudeFormatter, LatitudeFormatterimport cartopy.feature as cfeatureplt.figure(figsize=(20,10))ax = plt.axes(projection=ccrs.Mercator())ax.coastlines('10m')ax.xaxis.set_visible(True)ax.yaxis.set_visible(True)ax.set_yticks([56,57,58,59], crs=ccrs.PlateCarree())ax.set_xticks([-8, -6, -4, -2], crs=ccrs.PlateCarree())lon_formatter = LongitudeFormatter(zero_direction_label=True)lat_formatter = LatitudeFormatter()ax.xaxis.set_major_formatter(lon_formatter)ax.yaxis.set_major_formatter(lat_formatter)ax.set_extent([-8, -1.5, 55.3, 59])plt.scatter(sh['Longitude'],sh['Latitude'], color='red', marker='^', transform=ccrs.PlateCarree())plt.show()#plt.savefig("munros.png")??????????????????????????????????????????????????????????????????????? NGSA_field_pH.csv ??????????????????????? pH ????? TOS (Top of Soil) ???????????????? 10 cm ??? BOS (Bottom of Soil) ???????????????????? 10 cm ?????????????????????????????? plot ???? scatter ?????? TOS_field_pH ??????? scatter ?????? BOS_field_pH?????????????????? ?????????????? pH ??????? 7 – 8??? latitude ??????? -26 ??? -30Plot ????????????? (???????????????? latitude ??? longitude ??????????????????????????????????????? python) ................
................

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

Google Online Preview   Download