diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc index b4b7209..34b48d6 100644 Binary files a/__pycache__/__init__.cpython-36.pyc and b/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_load_data/__pycache__/__init__.cpython-36.pyc b/q01_load_data/__pycache__/__init__.cpython-36.pyc index 92b3ac2..cbc6b94 100644 Binary files a/q01_load_data/__pycache__/__init__.cpython-36.pyc and b/q01_load_data/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_load_data/__pycache__/build.cpython-36.pyc b/q01_load_data/__pycache__/build.cpython-36.pyc index e27baf6..1c664b7 100644 Binary files a/q01_load_data/__pycache__/build.cpython-36.pyc and b/q01_load_data/__pycache__/build.cpython-36.pyc differ diff --git a/q01_load_data/build.py b/q01_load_data/build.py index 69d7209..508bf0f 100644 --- a/q01_load_data/build.py +++ b/q01_load_data/build.py @@ -1,5 +1,13 @@ +# %load q01_load_data/build.py import pandas as pd - +path= 'data/excel-comp-data.xlsx' def q01_load_data(path): - "write your solution here" + df=pd.read_excel(path) + df['state']=df['state'].str.lower() + df['total']=df['Jan']=df['Feb']=df['Mar'] + return df + +q01_load_data(path) + + diff --git a/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc b/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc index 2a2dfc7..71fe0b0 100644 Binary files a/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc and b/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q01_load_data/tests/__pycache__/tests.cpython-36.pyc b/q01_load_data/tests/__pycache__/tests.cpython-36.pyc index 76e04c8..e7edca8 100644 Binary files a/q01_load_data/tests/__pycache__/tests.cpython-36.pyc and b/q01_load_data/tests/__pycache__/tests.cpython-36.pyc differ diff --git a/q02_append_row/__pycache__/__init__.cpython-36.pyc b/q02_append_row/__pycache__/__init__.cpython-36.pyc index de0cf61..2a67a5b 100644 Binary files a/q02_append_row/__pycache__/__init__.cpython-36.pyc and b/q02_append_row/__pycache__/__init__.cpython-36.pyc differ diff --git a/q02_append_row/__pycache__/build.cpython-36.pyc b/q02_append_row/__pycache__/build.cpython-36.pyc index 5088267..5901e83 100644 Binary files a/q02_append_row/__pycache__/build.cpython-36.pyc and b/q02_append_row/__pycache__/build.cpython-36.pyc differ diff --git a/q02_append_row/build.py b/q02_append_row/build.py index af3701d..4a02a13 100644 --- a/q02_append_row/build.py +++ b/q02_append_row/build.py @@ -1,11 +1,30 @@ +# %load q02_append_row/build.py import pandas as pd import sys, os #sys.path.append(os.path.join(os.path.dirname(os.curdir))) from greyatomlib.pandas_guided_project.q01_load_data.build import q01_load_data - +path='data/excel-comp-data.xlsx' def q02_append_row(path): - "write your solution here" + df=q01_load_data(path) + t1=pd.DataFrame(df['Jan']).sum() + t2=pd.DataFrame(df['Feb']).sum() + t3=pd.DataFrame(df['Mar']).sum() + t4=pd.DataFrame(df['total']).sum() + Total=[t1,t2,t3,t4] + df2=pd.DataFrame(columns=df.columns) + df2.loc[0]=df2['Jan'].append(t1) + df2.loc[0]=df2['Feb'].append(t2) + df2.loc[0]=df2['Mar'].append(t3) + df2.loc[0]=df2['total'].append(Total) + frames=[df,df2] + frame=pd.concat(frames,ignore_index=True) + return frame +q02_append_row(path) + + + + diff --git a/q02_append_row/tests/__pycache__/__init__.cpython-36.pyc b/q02_append_row/tests/__pycache__/__init__.cpython-36.pyc index dab3eca..5b891f5 100644 Binary files a/q02_append_row/tests/__pycache__/__init__.cpython-36.pyc and b/q02_append_row/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q02_append_row/tests/__pycache__/tests.cpython-36.pyc b/q02_append_row/tests/__pycache__/tests.cpython-36.pyc index 742ee79..ce9e1c3 100644 Binary files a/q02_append_row/tests/__pycache__/tests.cpython-36.pyc and b/q02_append_row/tests/__pycache__/tests.cpython-36.pyc differ diff --git a/q03_scrape_clean/__pycache__/__init__.cpython-36.pyc b/q03_scrape_clean/__pycache__/__init__.cpython-36.pyc index e99e173..d029d42 100644 Binary files a/q03_scrape_clean/__pycache__/__init__.cpython-36.pyc and b/q03_scrape_clean/__pycache__/__init__.cpython-36.pyc differ diff --git a/q03_scrape_clean/__pycache__/build.cpython-36.pyc b/q03_scrape_clean/__pycache__/build.cpython-36.pyc index cdec2c4..e235fdd 100644 Binary files a/q03_scrape_clean/__pycache__/build.cpython-36.pyc and b/q03_scrape_clean/__pycache__/build.cpython-36.pyc differ diff --git a/q03_scrape_clean/build.py b/q03_scrape_clean/build.py index a88e3e2..5d58fdf 100644 --- a/q03_scrape_clean/build.py +++ b/q03_scrape_clean/build.py @@ -1,9 +1,30 @@ +# %load q03_scrape_clean/build.py import pandas as pd + import sys, os import requests +from bs4 import BeautifulSoup sys.path.append(os.path.join(os.path.dirname(os.curdir))) +def q03_scrape_clean(url): + l= [] + headers={'content-type':'text'} + response = requests.get(url,headers = headers) + tab = pd.io.html.read_html(url) + Stoner = tab[0] + Stoner.drop(Stoner.index[0:11],inplace = True) + Stoner.reset_index(drop=True, inplace= True) + header = Stoner.iloc[0] + df1 = Stoner[1:] + df1.rename(columns=header,inplace=True) + df1['United States of America']=df1['United States of America'].apply(lambda x : (x.split('[')[0])) + df1.to_csv('scrapeddata.csv') + return df1 + -def q03_scrape_clean(url): - "write your solution here" + + +q03_scrape_clean('https://en.wikipedia.org/wiki/List_of_U.S._state_abbreviations') + + diff --git a/q03_scrape_clean/tests/__pycache__/__init__.cpython-36.pyc b/q03_scrape_clean/tests/__pycache__/__init__.cpython-36.pyc index bee36fb..28844e7 100644 Binary files a/q03_scrape_clean/tests/__pycache__/__init__.cpython-36.pyc and b/q03_scrape_clean/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q03_scrape_clean/tests/__pycache__/tests.cpython-36.pyc b/q03_scrape_clean/tests/__pycache__/tests.cpython-36.pyc index 8529c87..629c9f0 100644 Binary files a/q03_scrape_clean/tests/__pycache__/tests.cpython-36.pyc and b/q03_scrape_clean/tests/__pycache__/tests.cpython-36.pyc differ diff --git a/q04_mapping/__pycache__/__init__.cpython-36.pyc b/q04_mapping/__pycache__/__init__.cpython-36.pyc index ee0618f..e46661f 100644 Binary files a/q04_mapping/__pycache__/__init__.cpython-36.pyc and b/q04_mapping/__pycache__/__init__.cpython-36.pyc differ diff --git a/q04_mapping/__pycache__/build.cpython-36.pyc b/q04_mapping/__pycache__/build.cpython-36.pyc index 8283165..5ab9606 100644 Binary files a/q04_mapping/__pycache__/build.cpython-36.pyc and b/q04_mapping/__pycache__/build.cpython-36.pyc differ diff --git a/q04_mapping/build.py b/q04_mapping/build.py index 914cfa8..0e458af 100644 --- a/q04_mapping/build.py +++ b/q04_mapping/build.py @@ -3,8 +3,27 @@ import numpy as np #sys.path.append(os.path.join(os.path.dirname(os.curdir))) from greyatomlib.pandas_guided_project.q02_append_row.build import q02_append_row + +path1 = 'data/excel-comp-data.xlsx' +path2 = 'data/scraped.csv' + def q04_mapping(path1,path2): - "write your solution here" + 'write your solution here' + df1 = pd.read_excel(path1) + df1['total']=df1['Jan']+df1['Feb']+df1['Mar'] + df1.loc[len(df1),:]=df1.sum() + + df2 = pd.read_csv(path2) + + abbr_dict = dict(zip(df2.iloc[:,[1,6]]['United States of America'],df2.iloc[:,[1,6]]['Unnamed: 6'])) + + df1['abbr']=df1['state'].map(abbr_dict) + df1.drop(df1.columns[[6,7,8,9]], axis=1,inplace=True) + #print (df1) + return df1 + +q04_mapping(path1,path2) + diff --git a/q04_mapping/tests/__pycache__/__init__.cpython-36.pyc b/q04_mapping/tests/__pycache__/__init__.cpython-36.pyc index eef3d6b..d5c60ee 100644 Binary files a/q04_mapping/tests/__pycache__/__init__.cpython-36.pyc and b/q04_mapping/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q04_mapping/tests/__pycache__/test.cpython-36.pyc b/q04_mapping/tests/__pycache__/test.cpython-36.pyc index 7f7c96e..659fb9e 100644 Binary files a/q04_mapping/tests/__pycache__/test.cpython-36.pyc and b/q04_mapping/tests/__pycache__/test.cpython-36.pyc differ diff --git a/q05_replace_missing_values/__pycache__/__init__.cpython-36.pyc b/q05_replace_missing_values/__pycache__/__init__.cpython-36.pyc index f50c1d5..a81088b 100644 Binary files a/q05_replace_missing_values/__pycache__/__init__.cpython-36.pyc and b/q05_replace_missing_values/__pycache__/__init__.cpython-36.pyc differ diff --git a/q05_replace_missing_values/__pycache__/build.cpython-36.pyc b/q05_replace_missing_values/__pycache__/build.cpython-36.pyc index 6a32964..65f104f 100644 Binary files a/q05_replace_missing_values/__pycache__/build.cpython-36.pyc and b/q05_replace_missing_values/__pycache__/build.cpython-36.pyc differ diff --git a/q05_replace_missing_values/build.py b/q05_replace_missing_values/build.py index 97d9755..34b7113 100644 --- a/q05_replace_missing_values/build.py +++ b/q05_replace_missing_values/build.py @@ -1,3 +1,4 @@ +# %load q05_replace_missing_values/build.py import pandas as pd import numpy as np import sys @@ -8,6 +9,23 @@ path1 = 'data/excel-comp-data.xlsx' path2 = 'data/scraped.csv' def q05_replace_missing_values(path1,path2): + df1 = pd.read_excel(path1) + df1['total']=df1['Jan']+df1['Feb']+df1['Mar'] + df1.loc[len(df1),:]=df1.sum() + + df2 = pd.read_csv(path2) + + abbr_dict = dict(zip(df2.iloc[:,[1,6]]['United States of America'],df2.iloc[:,[1,6]]['Unnamed: 6'])) + + df1['abbr']=df1['state'].map(abbr_dict) + df1.drop(df1.columns[[6,7,8,9]], axis=1,inplace=True) + #df1.loc[df1[6,6].fillna('MS',inplace=True) + list1 = ['MSS','TEN','none'] + df1['abbr']=df1['abbr'].fillna('MS',limit=1) + df1['abbr']=df1['abbr'].fillna('TN',limit=1) + df1['abbr']=df1['abbr'].fillna('None',limit=1) + return df1 + +q05_replace_missing_values(path1,path2) -#print(q05_replace_missing_values(path1,path2).shape) \ No newline at end of file diff --git a/q05_replace_missing_values/tests/__pycache__/__init__.cpython-36.pyc b/q05_replace_missing_values/tests/__pycache__/__init__.cpython-36.pyc index 03391a7..05de7c2 100644 Binary files a/q05_replace_missing_values/tests/__pycache__/__init__.cpython-36.pyc and b/q05_replace_missing_values/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q05_replace_missing_values/tests/__pycache__/tests.cpython-36.pyc b/q05_replace_missing_values/tests/__pycache__/tests.cpython-36.pyc index 3b9d62a..8452f2d 100644 Binary files a/q05_replace_missing_values/tests/__pycache__/tests.cpython-36.pyc and b/q05_replace_missing_values/tests/__pycache__/tests.cpython-36.pyc differ diff --git a/q06_sub_total/__pycache__/__init__.cpython-36.pyc b/q06_sub_total/__pycache__/__init__.cpython-36.pyc index f70134c..eca733b 100644 Binary files a/q06_sub_total/__pycache__/__init__.cpython-36.pyc and b/q06_sub_total/__pycache__/__init__.cpython-36.pyc differ diff --git a/q06_sub_total/__pycache__/build.cpython-36.pyc b/q06_sub_total/__pycache__/build.cpython-36.pyc index adaf0ce..a29bc95 100644 Binary files a/q06_sub_total/__pycache__/build.cpython-36.pyc and b/q06_sub_total/__pycache__/build.cpython-36.pyc differ diff --git a/q06_sub_total/build.py b/q06_sub_total/build.py index c420838..16daa46 100644 --- a/q06_sub_total/build.py +++ b/q06_sub_total/build.py @@ -1,3 +1,4 @@ +# %load q06_sub_total/build.py import pandas as pd import numpy as np from sklearn.model_selection import train_test_split @@ -10,7 +11,27 @@ path2 = 'data/scraped.csv' def q06_sub_total(path1,path2): - "write your solution here" + df1 = pd.read_excel(path1) + df1['total']=df1['Jan']+df1['Feb']+df1['Mar'] + df1.loc[len(df1),:]=df1.sum() + df2 = pd.read_csv(path2) + abbr_dict = dict(zip(df2.iloc[:,[1,6]]['United States of America'],df2.iloc[:,[1,6]]['Unnamed: 6'])) + df1['abbr']=df1['state'].map(abbr_dict) +# df1.drop(df1.columns[[6,7,]], axis=1,inplace=True) + #df1.loc[df1[6,6].fillna('MS',inplace=True) + list1 = ['MSS','TEN','none'] + df1['abbr']=df1['abbr'].fillna('MS',limit=1) + df1['abbr']=df1['abbr'].fillna('TN',limit=1) + df1['abbr']=df1['abbr'].fillna('None',limit=1) + df1 = df1.drop(df1.index[len(df1)-1]) + df =df1.groupby('abbr')['Jan','Feb','Mar','total'].sum() + + return df + + +q06_sub_total(path1,path2) + + diff --git a/q06_sub_total/tests/__pycache__/__init__.cpython-36.pyc b/q06_sub_total/tests/__pycache__/__init__.cpython-36.pyc index 93ecd56..d9abfca 100644 Binary files a/q06_sub_total/tests/__pycache__/__init__.cpython-36.pyc and b/q06_sub_total/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q06_sub_total/tests/__pycache__/test.cpython-36.pyc b/q06_sub_total/tests/__pycache__/test.cpython-36.pyc index 691280a..e1ec325 100644 Binary files a/q06_sub_total/tests/__pycache__/test.cpython-36.pyc and b/q06_sub_total/tests/__pycache__/test.cpython-36.pyc differ diff --git a/q07_symbols/__pycache__/__init__.cpython-36.pyc b/q07_symbols/__pycache__/__init__.cpython-36.pyc index 60b0cca..d413963 100644 Binary files a/q07_symbols/__pycache__/__init__.cpython-36.pyc and b/q07_symbols/__pycache__/__init__.cpython-36.pyc differ diff --git a/q07_symbols/__pycache__/build.cpython-36.pyc b/q07_symbols/__pycache__/build.cpython-36.pyc index d28eaa9..993c15e 100644 Binary files a/q07_symbols/__pycache__/build.cpython-36.pyc and b/q07_symbols/__pycache__/build.cpython-36.pyc differ diff --git a/q07_symbols/build.py b/q07_symbols/build.py index b8cbb92..ea965d2 100644 --- a/q07_symbols/build.py +++ b/q07_symbols/build.py @@ -1,18 +1,39 @@ +# %load q07_symbols/build.py import pandas as pd import numpy as np from sklearn.model_selection import train_test_split import sys import os sys.path.append(os.path.join(os.path.dirname(os.curdir))) -from greyatomlib.pandas_guided_project.q06_sub_total.build import q06_sub_total +#from greyatomlib.pandas_guided_project.q06_sub_total.build import q06_sub_total path1 = 'data/excel-comp-data.xlsx' path2 = 'data/scraped.csv' -def q07_symbols(path1,path2): - "write your solution here" +def q07_symbols(path1, path2): + df1 = pd.read_excel(path1) + df1['total']=df1['Jan']+df1['Feb']+df1['Mar'] + df1.loc[len(df1),:]=df1.sum() + df2 = pd.read_csv(path2) + abbr_dict = dict(zip(df2.iloc[:,[1,6]]['United States of America'],df2.iloc[:,[1,6]]['Unnamed: 6'])) + df1['abbr']=df1['state'].map(abbr_dict) + #df1.drop(df1.columns[[6,7,]], axis=1,inplace=True) + #df1.loc[df1[6,6].fillna('MS',inplace=True) + list1 = ['MSS','TEN','none'] + df1['abbr']=df1['abbr'].fillna('MS',limit=1) + df1['abbr']=df1['abbr'].fillna('TN',limit=1) + df1['abbr']=df1['abbr'].fillna('None',limit=1) + df1 = df1.drop(df1.index[len(df1)-1]) + df =df1.groupby('abbr')['Jan','Feb','Mar','total'].sum() + df['total'] = df['total'].astype(int).apply(lambda x: '{:,}'.format(x)) + df=df.applymap(lambda x: '$'+ str(x)) + return df + + + +q07_symbols(path1, path2) + -#print(q07_symbols(path1,path2)) diff --git a/q07_symbols/tests/__pycache__/__init__.cpython-36.pyc b/q07_symbols/tests/__pycache__/__init__.cpython-36.pyc index f854b4a..95d8baf 100644 Binary files a/q07_symbols/tests/__pycache__/__init__.cpython-36.pyc and b/q07_symbols/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q07_symbols/tests/__pycache__/test.cpython-36.pyc b/q07_symbols/tests/__pycache__/test.cpython-36.pyc index 1a8a9c3..65eea9b 100644 Binary files a/q07_symbols/tests/__pycache__/test.cpython-36.pyc and b/q07_symbols/tests/__pycache__/test.cpython-36.pyc differ diff --git a/q08_append_subtotals/__pycache__/__init__.cpython-36.pyc b/q08_append_subtotals/__pycache__/__init__.cpython-36.pyc index df1c3a2..6b6437a 100644 Binary files a/q08_append_subtotals/__pycache__/__init__.cpython-36.pyc and b/q08_append_subtotals/__pycache__/__init__.cpython-36.pyc differ diff --git a/q08_append_subtotals/__pycache__/build.cpython-36.pyc b/q08_append_subtotals/__pycache__/build.cpython-36.pyc index d03d4af..b0df525 100644 Binary files a/q08_append_subtotals/__pycache__/build.cpython-36.pyc and b/q08_append_subtotals/__pycache__/build.cpython-36.pyc differ diff --git a/q08_append_subtotals/build.py b/q08_append_subtotals/build.py index 96e2f9e..e249ffa 100644 --- a/q08_append_subtotals/build.py +++ b/q08_append_subtotals/build.py @@ -1,15 +1,47 @@ +# %load q08_append_subtotals/build.py import pandas as pd import numpy as np import sys,os #sys.path.append(os.path.join(os.path.dirname(os.curdir))) -from greyatomlib.pandas_guided_project.q06_sub_total.build import q06_sub_total -from greyatomlib.pandas_guided_project.q07_symbols.build import q07_symbols +#from greyatomlib.pandas_guided_project.q06_sub_total.build import q06_sub_total +#from greyatomlib.pandas_guided_project.q07_symbols.build import q07_symbols path1 = 'data/excel-comp-data.xlsx' path2 = 'data/scraped.csv' def q08_append_subtotals(path1,path2): - "write your solution here" + df1 = pd.read_excel(path1) + df1['total']=df1['Jan']+df1['Feb']+df1['Mar'] + df1.loc[len(df1),:]=df1.sum() + df2 = pd.read_csv(path2) + abbr_dict = dict(zip(df2.iloc[:,[1,6]]['United States of America'],df2.iloc[:,[1,6]]['Unnamed: 6'])) + df1['abbr']=df1['state'].map(abbr_dict) + df1['abbr']=df1['abbr'].fillna('MS',limit=1) + df1['abbr']=df1['abbr'].fillna('TN',limit=1) + df1['abbr']=df1['abbr'].fillna('None',limit=1) + df1 = df1.drop(df1.index[len(df1)-1]) + df =df1.groupby('abbr')['Jan','Feb','Mar','total'].sum() + + + t1 = pd.DataFrame(df['Jan']).sum() + t2 = pd.DataFrame(df['Feb']).sum() + t3 = pd.DataFrame(df['Mar']).sum() + t4 = pd.DataFrame(df['total']).sum() + Total = [t1,t2,t3,t4] + df2 = pd.DataFrame(columns=df.columns) + df2.loc[0] = df2['Jan'].append(Total) + df_final = pd.concat([df, df2]) + df_final['total'] = df_final['total'].astype(int).apply(lambda x: '{:,}'.format(x)) + df_final['Jan'] = df_final['Jan'].astype(int).apply(lambda x: '{:,}'.format(x)) + df_final['Feb'] = df_final['Feb'].astype(int).apply(lambda x: '{:,}'.format(x)) + df_final['Mar'] = df_final['Mar'].astype(int).apply(lambda x: '{:,}'.format(x)) + df_final=df_final.applymap(lambda x: '$'+ str(x)) + df_final=df_final.rename(index={0: 'Total'}) + return df_final + +q08_append_subtotals(path1,path2) + + diff --git a/q08_append_subtotals/tests/__pycache__/__init__.cpython-36.pyc b/q08_append_subtotals/tests/__pycache__/__init__.cpython-36.pyc index 21f4cd0..786d61b 100644 Binary files a/q08_append_subtotals/tests/__pycache__/__init__.cpython-36.pyc and b/q08_append_subtotals/tests/__pycache__/__init__.cpython-36.pyc differ diff --git a/q08_append_subtotals/tests/__pycache__/tests.cpython-36.pyc b/q08_append_subtotals/tests/__pycache__/tests.cpython-36.pyc index da1ab93..a6fee46 100644 Binary files a/q08_append_subtotals/tests/__pycache__/tests.cpython-36.pyc and b/q08_append_subtotals/tests/__pycache__/tests.cpython-36.pyc differ diff --git a/scrapeddata.csv b/scrapeddata.csv new file mode 100644 index 0000000..c9fe2f6 --- /dev/null +++ b/scrapeddata.csv @@ -0,0 +1,78 @@ +,United States of America,Federal state,".mw-parser-output .monospaced{font-family:monospace,monospace}USUSA840",US,00,,,U.S.,U.S.,U.S.A.,,,,, +1,Alabama,State,US-AL,AL,01,AL,AL,Ala.,Ala.,,,,,, +2,Alaska,State,US-AK,AK,02,AK,AK,Alaska,Alaska,Alas.,,,,, +3,Arizona,State,US-AZ,AZ,04,AZ,AZ,Ariz.,Ariz.,Az.,,,,, +4,Arkansas,State,US-AR,AR,05,AR,AR,Ark.,Ark.,,,,,, +5,California,State,US-CA,CA,06,CA,CF,Calif.,Calif.,"Ca., Cal.",,,,, +6,Colorado,State,US-CO,CO,08,CO,CL,Colo.,Colo.,Col.,,,,, +7,Connecticut,State,US-CT,CT,09,CT,CT,Conn.,Conn.,Ct.,,,,, +8,Delaware,State,US-DE,DE,10,DE,DL,Del.,Del.,De.,,,,, +9,District of Columbia,Federal district,US-DC,DC,11,DC,DC,D.C.,D.C.,Wash. D.C.,,,,, +10,Florida,State,US-FL,FL,12,FL,FL,Fla.,Fla.,"Fl., Flor.",,,,, +11,Georgia,State,US-GA,GA,13,GA,GA,Ga.,Ga.,Geo.,,,,, +12,Hawaii,State,US-HI,HI,15,HI,HA,Hawaii,Hawaii,H.I.,,,,, +13,Idaho,State,US-ID,ID,16,ID,ID,Idaho,Idaho,"Id., Ida.",,,,, +14,Illinois,State,US-IL,IL,17,IL,IL,Ill.,Ill.,"Il., Ills., Ill's",,,,, +15,Indiana,State,US-IN,IN,18,IN,IN,Ind.,Ind.,In.,,,,, +16,Iowa,State,US-IA,IA,19,IA,IA,Iowa,Iowa,"Ia., Ioa.[1]",,,,, +17,Kansas,State,US-KS,KS,20,KS,KA,Kans.,Kan.,"Ks., Ka.",,,,, +18,Kentucky,State (Commonwealth),US-KY,KY,21,KY,KY,Ky.,Ky.,"Ken., Kent.",,,,, +19,Louisiana,State,US-LA,LA,22,LA,LA,La.,La.,,,,,, +20,Maine,State,US-ME,ME,23,ME,ME,Maine,Maine,Me.,,,,, +21,Maryland,State,US-MD,MD,24,MD,MD,Md.,Md.,,,,,, +22,Massachusetts,State (Commonwealth),US-MA,MA,25,MA,MS,Mass.,Mass.,,,,,, +23,Michigan,State,US-MI,MI,26,MI,MC,Mich.,Mich.,,,,,, +24,Minnesota,State,US-MN,MN,27,MN,MN,Minn.,Minn.,Mn.,,,,, +25,Mississippi,State,US-MS,MS,28,MS,MI,Miss.,Miss.,,,,,, +26,Missouri,State,US-MO,MO,29,MO,MO,Mo.,Mo.,,,,,, +27,Montana,State,US-MT,MT,30,MT,MT,Mont.,Mont.,,,,,, +28,Nebraska,State,US-NE,NE,31,NE,NB,Nebr.,Neb.,,,,,, +29,Nevada,State,US-NV,NV,32,NV,NV,Nev.,Nev.,Nv.,,,,, +30,New Hampshire,State,US-NH,NH,33,NH,NH,N.H.,N.H.,,,,,, +31,New Jersey,State,US-NJ,NJ,34,NJ,NJ,N.J.,N.J.,N.Jersey,,,,, +32,New Mexico,State,US-NM,NM,35,NM,NM,N. Mex.,N.M.,New M.,,,,, +33,New York,State,US-NY,NY,36,NY,NY,N.Y.,N.Y.,N. York,,,,, +34,North Carolina,State,US-NC,NC,37,NC,NC,N.C.,N.C.,N. Car.,,,,, +35,North Dakota,State,US-ND,ND,38,ND,ND,N. Dak.,N.D.,NoDak,,,,, +36,Ohio,State,US-OH,OH,39,OH,OH,Ohio,Ohio,"O., Oh.",,,,, +37,Oklahoma,State,US-OK,OK,40,OK,OK,Okla.,Okla.,Ok.,,,,, +38,Oregon,State,US-OR,OR,41,OR,OR,Oreg.,Ore.,Or.,,,,, +39,Pennsylvania,State (Commonwealth),US-PA,PA,42,PA,PA,Pa.,Pa.,"Penn., Penna.",,,,, +40,Rhode Island,State,US-RI,RI,44,RI,RI,R.I.,R.I.,"R.I. & P.P., R. Isl.",,,,, +41,South Carolina,State,US-SC,SC,45,SC,SC,S.C.,S.C.,S. Car.,,,,, +42,South Dakota,State,US-SD,SD,46,SD,SD,S. Dak.,S.D.,SoDak,,,,, +43,Tennessee,State,US-TN,TN,47,TN,TN,Tenn.,Tenn.,,,,,, +44,Texas,State,US-TX,TX,48,TX,TX,Tex.,Texas,Tx.,,,,, +45,Utah,State,US-UT,UT,49,UT,UT,Utah,Utah,Ut.,,,,, +46,Vermont,State,US-VT,VT,50,VT,VT,Vt.,Vt.,,,,,, +47,Virginia,State (Commonwealth),US-VA,VA,51,VA,VA,Va.,Va.,Virg.,,,,, +48,Washington,State,US-WA,WA,53,WA,WN,Wash.,Wash.,"Wa., Wn.[2]",,,,, +49,West Virginia,State,US-WV,WV,54,WV,WV,W. Va.,W.Va.,"W.V., W. Virg.",,,,, +50,Wisconsin,State,US-WI,WI,55,WI,WS,Wis.,Wis.,"Wi., Wisc.",,,,, +51,Wyoming,State,US-WY,WY,56,WY,WY,Wyo.,Wyo.,Wy.,,,,, +52,American Samoa,Insular area (Territory),ASASM016US-AS,AS,60,AS,AS,A.S.,,,,,,, +53,Guam,Insular area (Territory),GUGUM316US-GU,GU,66,GU,GU,Guam,,,,,,, +54,Northern Mariana Islands,Insular area (Commonwealth),MPMNP580US-MP,MP,69,MP,CM,M.P.,,CNMI[3],,,,, +55,Puerto Rico,Insular area (Territory),PRPRI630US-PR,PR,72,PR,PR,P.R.,,,,,,, +56,U.S. Virgin Islands,Insular area (Territory),VIVIR850US-VI,VI,78,VI,VI,V.I.,,U.S.V.I.,,,,, +57,U.S. Minor Outlying Islands,Insular areas,UMUMI581US-UM,UM,74,,,,,,,,,, +58,Baker Island,island,UM-81,,81,,,,,XB[4],,,,, +59,Howland Island,island,UM-84,,84,,,,,XH[4],,,,, +60,Jarvis Island,island,UM-86,,86,,,,,XQ[4],,,,, +61,Johnston Atoll,atoll,UM-67,,67,,,,,XU[4],,,,, +62,Kingman Reef,atoll,UM-89,,89,,,,,XM[4],,,,, +63,Midway Islands,atoll,UM-71,,71,,,,,QM[4],,,,, +64,Navassa Island,island,UM-76,,76,,,,,XV[4],,,,, +65,Palmyra Atoll,atoll[5],UM-95,,95,,,,,XL[4],,,,, +66,Wake Island,atoll,UM-79,,79,,,,,QW[4],,,,, +67,Micronesia,Freely associated state,FMFSM583,FM,64,FM,,,,,,,,, +68,Marshall Islands,Freely associated state,MHMHL584,MH,68,MH,,,,,,,,, +69,Palau,Freely associated state,PWPLW585,PW,70,PW,,,,,,,,, +70,U.S. Armed Forces – Americas,US military mail code,,,,AA,,,,,,,,, +71,U.S. Armed Forces – Europe,US military mail code,,,,AE,,,,,,,,, +72,U.S. Armed Forces – Pacific,US military mail code,,,,AP,,,,,,,,, +73,Northern Mariana Islands,Obsolete postal code[9],,,,CM,,,,,,,,, +74,Panama Canal Zone,Obsolete postal code,PZPCZ594,,,CZ,,,,,,,,, +75,Nebraska,Obsolete postal code[10],,,,NB,,,,,,,,, +76,Philippine Islands,Obsolete postal code,PHPHL608[11],,,PI,,,,,,,,, +77,Trust Territory of the Pacific Islands,Obsolete postal code,PCPCI582,,,TT,,,,,,,,,