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 #43

Open
wants to merge 1 commit 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.
14 changes: 13 additions & 1 deletion q01_load_data/build.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# %load q01_load_data/build.py
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split


path='./data/olympics.csv'
def q01_load_data(path):
"write your solution here"
'write your solution here'
df=pd.read_csv(path,header=0)
new_header=df.iloc[0]
new_header[0]='country name'
df=df[1:]
df.columns=new_header
return df
# use .read_csv function to read the
# data and header=0 to skip the first row


df=q01_load_data(path)
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.
11 changes: 8 additions & 3 deletions q02_rename_columns/build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# %load q02_rename_columns/build.py
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from greyatomlib.olympics_project.q01_load_data.build import q01_load_data

path='./data/olympics.csv'
def q02_rename_columns(path):
"write your solution here"
'write your solution here'
df = q01_load_data(path)

df.rename(columns={'01 !':'Gold','02 !':'Silver','03 !':'Bronze'},inplace=True)
return df
df=q02_rename_columns(path)
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.