From cd6c353a45c0867416c58e294239045482767c9d Mon Sep 17 00:00:00 2001 From: seema200 Date: Sat, 19 May 2018 13:59:21 +0000 Subject: [PATCH 1/3] Done --- __pycache__/__init__.cpython-36.pyc | Bin 148 -> 141 bytes .../__pycache__/__init__.cpython-36.pyc | Bin 162 -> 155 bytes .../__pycache__/build.cpython-36.pyc | Bin 397 -> 504 bytes q01_load_data/build.py | 10 ++++++---- .../tests/__pycache__/__init__.cpython-36.pyc | Bin 168 -> 161 bytes .../tests/__pycache__/test.cpython-36.pyc | Bin 1529 -> 1528 bytes 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/__pycache__/__init__.cpython-36.pyc b/__pycache__/__init__.cpython-36.pyc index 91557cd05bf4f07dc1526cbb9ff684bfca7460c3..bdb5f7929233d459738c86b90acf19575a27b6b4 100644 GIT binary patch delta 50 zcmbQj*vrUa%*)G_s>TpKk;7chN{YEiL%Vp2wCaYkx(acNRfVs2tyW@4UxUTS%K MT4qja@x)jI01CYm+5i9m diff --git a/q01_load_data/__pycache__/__init__.cpython-36.pyc b/q01_load_data/__pycache__/__init__.cpython-36.pyc index 5e9e2e2740ce75441ea56a2372f1c0fc7b50e02f..8362c977716ab0d1aa74e2cd5ad52bd783a7e682 100644 GIT binary patch delta 50 zcmZ3)IGd5fn3tC;RgEEfB8R!0hkizWZmNE9YHDtxk%57Jcz#iKaY15os(x~QO6tTE FI{;Md4>|w< delta 57 zcmbQuxQLO%n3tE!)hZ%tB8R!EzkXny!ac8LQ+SGKSXj%VO1)0;@spT?Ab)StLYFGFN|kar7^L^w zJlR_2D$O;j&DZEW4lx2pAfN{^L|_hsPP#s-Wrfn3PLSInTpaKG{pddu+h;ia1Jck% A+yDRo delta 204 zcmeyt+{?^m%*)GFZW9wVn_(hXW<4VV0|N*<19346kVs(+X3%7+k|;0AEJ;K!Q^-gyO7&aGpvicPr692+qlg)(9!&i5(GM+7Eh^SeOv=bC&PdHJE=?** z%uUS8Ow7~IOD&I2%gjkF*3ZwW%q_@FE{-oK%FjwoF3~TX9Kfh44m5?Khz&?+vfpAW eNX$z~EWX85kTQ8Lqn0R07-0{D#X9*8qYMC{o;YU! diff --git a/q01_load_data/build.py b/q01_load_data/build.py index 1a26cc1..d3b99fc 100644 --- a/q01_load_data/build.py +++ b/q01_load_data/build.py @@ -4,7 +4,9 @@ def q01_load_data(path): - "write your solution here" - # use .read_csv function to read the - # data and header=0 to skip the first row - + dd=pd.read_csv(path,header=0) + header=dd.iloc[0] + header[0]='Country Name' + new_df=dd[1:] + new_df.columns=header + return new_df diff --git a/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc b/q01_load_data/tests/__pycache__/__init__.cpython-36.pyc index 46496ca72cf628223c8e5f0e036e3f379bb90b43..b8e3b0c5d962afbf9cccd11e16b241595874e132 100644 GIT binary patch delta 50 zcmZ3%xR8;m-q-GbFCKV;- zCgx=(=IQ69mdB@M=A;%+7GUyW Date: Sat, 19 May 2018 14:20:35 +0000 Subject: [PATCH 2/3] Done --- .../__pycache__/__init__.cpython-36.pyc | Bin 167 -> 160 bytes .../__pycache__/build.cpython-36.pyc | Bin 509 -> 598 bytes q02_rename_columns/build.py | 3 ++- .../tests/__pycache__/__init__.cpython-36.pyc | Bin 173 -> 166 bytes .../tests/__pycache__/test.cpython-36.pyc | Bin 1628 -> 1625 bytes 5 files changed, 2 insertions(+), 1 deletion(-) diff --git a/q02_rename_columns/__pycache__/__init__.cpython-36.pyc b/q02_rename_columns/__pycache__/__init__.cpython-36.pyc index 687491c04ee351a2a8984006b2759809a18bb255..e8a7b7abeb11a6494de6acfbc9ada319821f6166 100644 GIT binary patch delta 50 zcmZ3^xPXzvn3tC;RgEEfB8R!0uYN{;ZmNE9YHDtxk%57Jcz#iKaY15os(x~QO6tTE FX8>1#4^998 delta 57 zcmZ3$xSWy0n3tDJ+A1PyB8RzZh<<2sYEiL%Vp2wCaYkx(acNRfVs2tyW@4UxUTS%K MT4qja@x)kX0PffmRR910 diff --git a/q02_rename_columns/__pycache__/build.cpython-36.pyc b/q02_rename_columns/__pycache__/build.cpython-36.pyc index 28092f56cbf20b2cf3ed76ec58daec0caa77a3c0..7e4b40d23e59de8ebd9fff4b82a2673b8f299ff9 100644 GIT binary patch delta 253 zcmey%e2s)S^^BO~xW-pn6TFTPy{MB^kGvQqop36tMw?eg*1>7N-^! z>nA2F1@E$ERiHq!#Pv=TznvWF{9+&S13V0J(vIsfc6p aMn)ONTa(W*hKh0kMZo4E5$uyKnB)MC88rp~ diff --git a/q02_rename_columns/build.py b/q02_rename_columns/build.py index 20dd8e9..eb964de 100644 --- a/q02_rename_columns/build.py +++ b/q02_rename_columns/build.py @@ -6,4 +6,5 @@ def q02_rename_columns(path): "write your solution here" df = q01_load_data(path) - \ No newline at end of file + df.rename(columns={"01 !": "Gold", "02 !": "Silver", "03 !": "Bronze"},inplace=True) + return df diff --git a/q02_rename_columns/tests/__pycache__/__init__.cpython-36.pyc b/q02_rename_columns/tests/__pycache__/__init__.cpython-36.pyc index 198a8989427b98b820ac8af30a735121ced2b430..4b7e5c28bb449af8c6bf77f9e7ceb8534fb4e582 100644 GIT binary patch delta 50 zcmZ3>xQvm*n3tC;RgEEfB8RzLuzp5 delta 114 zcmcb~bBBl1n3tF9L_|cC;zmwhMi#F0)RN6|jNOc?VfvxPsYS*5iAfom#TlvD#idC_ ziMfe+nTdJ&d8y^`X_+~x#hZ^aF)=dU+I)(+mXS@Afq|h&ahuABqj^6c>(|~z$7vN From d50b3c33c465a0b2361a988538c3ae469b0104cc Mon Sep 17 00:00:00 2001 From: seema200 Date: Sat, 19 May 2018 15:12:31 +0000 Subject: [PATCH 3/3] Done --- .../__pycache__/__init__.cpython-36.pyc | Bin 166 -> 159 bytes .../__pycache__/build.cpython-36.pyc | Bin 522 -> 838 bytes q03_split_country/build.py | 7 ++++++- .../tests/__pycache__/__init__.cpython-36.pyc | Bin 172 -> 165 bytes .../tests/__pycache__/test.cpython-36.pyc | Bin 1424 -> 1421 bytes 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/q03_split_country/__pycache__/__init__.cpython-36.pyc b/q03_split_country/__pycache__/__init__.cpython-36.pyc index e71d6ad8447b136dd4ced8957fb372b04928ae9b..2296baa18705b596039026702ff2dfcd809c433f 100644 GIT binary patch delta 50 zcmZ3+IG>Tjn3tC;RgEEfB8R!0kA6meZmNE9YHDtxk%57Jcz#iKaY15os(x~QO6tTE FCjeIb4@v+4 delta 57 zcmbQwxQvm*n3tDJ-6|q#B8RzZuzqN9YEiL%Vp2wCaYkx(acNRfVs2tyW@4UxUTS%K MT4qja@x)js0PuekT>t<8 diff --git a/q03_split_country/__pycache__/build.cpython-36.pyc b/q03_split_country/__pycache__/build.cpython-36.pyc index 5935601a743a778838cf0355c720e3720a4bcae6..dee9e1cbf843d73dbc799564b4aa3dcdb0bd7fea 100644 GIT binary patch literal 838 zcmZvayKdVs6oyINEIUq-W=NaOW3)&{(rkuNpi`F&O@IRGAkZS~$l)!dgjj|%C2Jp~ z57L*=+9|J)sfRLJ1Z@eNL-N-l_?@3R+utAkn4>Ry9zs9SivfG|9>TtZL=nXt<+z`{ z+=toYfe7;uyKg>^#2_EQI-ubr%43QzQ4&4DNpz9m?w~fLl10sIU0BVl8nnaP>1kn@ zB!U&C;*F5D#O?qLA0mYK0AW8ts?iob;CsBq6d$7%rXKYlL2>&T+Nt;67Oy;tm)KFz z=$ntx7PP|e^#P4R9rmiD8*Sd+nW|=!RyAf~fuOFGoLn=*Hsew?vNr9+(fy%vbk3Da zNA(KQ7OlXS2cS6yG4U^+@riL&&|dhvPrUw)%mBpakJ+^nEVGOWayp%6pOv|>nv^Un z6=j*?tFY4I^(K@c@B%+ktauZm3Uo1)|KrBmDC&{^5{y{P`GQr?;=hX47PhvZN`w2z_@qG zL!vcr^MD$qyRed!trNcsG^wvUkABUElHC=(+_$|;F`Vp<{*UO)>HS1rjE``P4{?MK zuzBq+9d?l>k`mi_n&zQw1hnr-oxia+oDm~a0p{_-G7g@>3mW%C`T5eYmefk{YLWi! lZ2Ir7m-g274fglGKzDei=Z|M_SHs!dIcS{}1ML`({a+>C+3)}W delta 195 zcmX@c*2ThQ%*)HAXA=`8$vBa#Tb_x5fdPb_fw-6lNR%+tFf=pPGNv#FGiWkR{3Ye+ zr^#5v43yDiy2VnESdwvzDJ5+sLlGNL=vRP#XmM&$v3_DwMrLtFYIbpHQc+@VVqRuq zo_=0xd3;)CPHOSwPDb6yIZQIDAd487ia0=qao%DpNX$z~EWX85kaCMPuQa!y@)lEG W!L7+VnW98NO29TC5$uySnB@RSz%mQ~ diff --git a/q03_split_country/build.py b/q03_split_country/build.py index 6c075fb..cd0e9c7 100644 --- a/q03_split_country/build.py +++ b/q03_split_country/build.py @@ -7,4 +7,9 @@ def q03_summer_gold_medals(path): "write your solution here" df = q02_rename_columns(path) - \ No newline at end of file + df['country name']=df['country name'].apply(lambda x: x.split('(')[0]) + new_index=df['country name'] + df.drop(['country name'],axis=1,inplace=True) + df.index=new_index + df.drop(labels='Totals', axis=0,inplace=True) + return df diff --git a/q03_split_country/tests/__pycache__/__init__.cpython-36.pyc b/q03_split_country/tests/__pycache__/__init__.cpython-36.pyc index 6015fed2dbea86e31eda4681fd1f53f29b2ef18c..64a3b3ed922791aaf423a6d78f794cbd9045754c 100644 GIT binary patch delta 50 zcmZ3(xRjB@n3tC;RgEEfB8RzLkbXvfZmNE9YHDtxk%57Jcz#iKaY15os(x~QO6tTE F4**&e4`KiS delta 57 zcmZ3=xQ3C#n3tDpgMUQSL=JP+Nd3^_)S_bj#H5VO;*8Yn;?ks|#N5QZ%)~tXywvje Mw9K5;;)$^y01>Yg6951J diff --git a/q03_split_country/tests/__pycache__/test.cpython-36.pyc b/q03_split_country/tests/__pycache__/test.cpython-36.pyc index 51cbfae7c470758b6df9dd0e79f7b32a29cac8f3..3d4816d154a1af17c93e64aed8cfed81e0d77bae 100644 GIT binary patch delta 94 zcmbQh-OJ5s%*)G_s>Tp)Fp={t2VZ(>Nm^-6&c<7^jBp1{p%%*)I5G&~|oV