Skip to content
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.
11 changes: 9 additions & 2 deletions q01_load_data/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import pandas as pd


def q01_load_data(path):
"write your solution here"
path='data/excel-comp-data.xlsx'
data = pd.read_excel(path)
#data['state']= map(lambda x: x.lower(), data['state'])
df1=data['state'].str.lower()
data['state']=df1
data['total']=data['Jan']+data['Feb']+data['Mar']
return data


Binary file modified q01_load_data/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q01_load_data/tests/__pycache__/tests.cpython-36.pyc
Binary file not shown.
Binary file modified q02_append_row/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_append_row/__pycache__/build.cpython-36.pyc
Binary file not shown.
23 changes: 18 additions & 5 deletions q02_append_row/build.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import pandas as pd
import sys, os
#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
#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"

def q01_load_data(path):
data = pd.read_excel(path)
df1=data['state'].str.lower()
data['state']=df1
data['total']=data['Jan']+data['Feb']+data['Mar']
return data

def q02_append_row(path):
df=q01_load_data(path)
sum_jan=sum(df['Jan'])
sum_feb=sum(df['Feb'])
sum_mar=sum(df['Mar'])
sum_tot=sum(df['total'])
s = pd.Series([sum_jan, sum_feb, sum_mar, sum_tot], index=['Jan', 'Feb','Mar', 'total'])
df = df.append(s,ignore_index=True)
return df


Binary file modified q02_append_row/tests/__pycache__/__init__.cpython-36.pyc
Binary file not shown.
Binary file modified q02_append_row/tests/__pycache__/tests.cpython-36.pyc
Binary file not shown.