From 1bad20952fd1bea0f57c4aa11b63e2ef7313ec2d Mon Sep 17 00:00:00 2001 From: Umang81 Date: Sun, 2 Sep 2018 10:56:06 +0000 Subject: [PATCH 1/4] Done --- q01_read_data/build.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/q01_read_data/build.py b/q01_read_data/build.py index e13d2f74..afa3b617 100644 --- a/q01_read_data/build.py +++ b/q01_read_data/build.py @@ -1,12 +1,20 @@ +# %load q01_read_data/build.py import yaml def read_data(): - - # import the csv file into `data` variable + with open('./data/ipl_match.yaml') as f: + # import the csv file into variable # You can use this path to access the CSV file: '../data/ipl_match.yaml' # Write your code here - data = + data = yaml.load(f) + + f.close() # return data variable return data + + + + + From 99a70391959b3efa43fbe4124069a4bb1a984cb1 Mon Sep 17 00:00:00 2001 From: Umang81 Date: Tue, 4 Sep 2018 10:13:43 +0000 Subject: [PATCH 2/4] Done --- q02_teams/build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/q02_teams/build.py b/q02_teams/build.py index 3cf9d3cf..46ac5ecf 100644 --- a/q02_teams/build.py +++ b/q02_teams/build.py @@ -1,3 +1,4 @@ +# %load q02_teams/build.py # default imports from greyatomlib.python_getting_started.q01_read_data.build import read_data data = read_data() @@ -7,5 +8,13 @@ def teams(data=data): # write your code here #teams = + teams = [] + for item in info['teams']: + teams.append(item) + print (teams) + return teams + + + From 876979d11e952cb80efea3b33efe4ce92c445a0c Mon Sep 17 00:00:00 2001 From: Umang81 Date: Sat, 8 Sep 2018 10:15:36 +0000 Subject: [PATCH 3/4] Done --- q02_teams/build.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/q02_teams/build.py b/q02_teams/build.py index 46ac5ecf..3aac64d8 100644 --- a/q02_teams/build.py +++ b/q02_teams/build.py @@ -1,19 +1,10 @@ -# %load q02_teams/build.py # default imports from greyatomlib.python_getting_started.q01_read_data.build import read_data data = read_data() # solution def teams(data=data): - - # write your code here - #teams = - teams = [] - for item in info['teams']: - teams.append(item) - - print (teams) - + teams = data['info']['teams'] return teams From 23517998c65c1586b1c0e52706dc07f4f8909390 Mon Sep 17 00:00:00 2001 From: Umang81 Date: Sat, 8 Sep 2018 10:27:06 +0000 Subject: [PATCH 4/4] Done --- q03_first_batsman/build.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/q03_first_batsman/build.py b/q03_first_batsman/build.py index 84984081..dc726944 100644 --- a/q03_first_batsman/build.py +++ b/q03_first_batsman/build.py @@ -1,3 +1,4 @@ +# %load q03_first_batsman/build.py # Default Imports from greyatomlib.python_getting_started.q01_read_data.build import read_data data = read_data() @@ -6,8 +7,8 @@ def first_batsman(data=data): # Write your code here + name = data['innings'][0]['1st innings']['deliveries'][0][0.1]['batsman'] + return name - - return name