Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit Live PR #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified __pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_load_data/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_load_data/__pycache__/build.cpython-36.pyc
Binary file not shown.
10 changes: 6 additions & 4 deletions q01_load_data/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file modified q01_load_data/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_load_data/tests/__pycache__/test.cpython-36.pyc
Binary file not shown.
Binary file modified q02_rename_columns/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_rename_columns/__pycache__/build.cpython-36.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion q02_rename_columns/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
def q02_rename_columns(path):
"write your solution here"
df = q01_load_data(path)

df.rename(columns={"01 !": "Gold", "02 !": "Silver", "03 !": "Bronze"},inplace=True)
return df
Binary file modified q02_rename_columns/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_rename_columns/tests/__pycache__/test.cpython-36.pyc
Binary file not shown.
Binary file modified q03_split_country/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q03_split_country/__pycache__/build.cpython-36.pyc
Binary file not shown.
7 changes: 6 additions & 1 deletion q03_split_country/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
def q03_summer_gold_medals(path):
"write your solution here"
df = q02_rename_columns(path)

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
Binary file modified q03_split_country/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q03_split_country/tests/__pycache__/test.cpython-36.pyc
Binary file not shown.