From 1ea774f9bacb7c0fd594ee171c5615df32eb3ddf Mon Sep 17 00:00:00 2001 From: Nile28 Date: Sat, 22 Sep 2018 06:23:17 +0000 Subject: [PATCH 1/6] Done --- q01_read_data/build.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/q01_read_data/build.py b/q01_read_data/build.py index e13d2f74..3d7087cc 100644 --- a/q01_read_data/build.py +++ b/q01_read_data/build.py @@ -1,12 +1,17 @@ +# %load q01_read_data/build.py import yaml def read_data(): - # import the csv file into `data` variable + # 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(open('./data/ipl_match.yaml')) # return data variable return data + + + + From 02af013546eaa748e171d84724699ab05794fbc7 Mon Sep 17 00:00:00 2001 From: Nile28 Date: Sun, 23 Sep 2018 12:01:03 +0000 Subject: [PATCH 2/6] Done --- q02_teams/build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/q02_teams/build.py b/q02_teams/build.py index 3cf9d3cf..35cbdb8f 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() @@ -6,6 +7,11 @@ def teams(data=data): # write your code here - #teams = + teams =data['info']['teams'] return teams + +type(data) +data['info']['teams'] + + From 657b69849226881ea387fab0418279eecf7ceb50 Mon Sep 17 00:00:00 2001 From: Nile28 Date: Thu, 27 Sep 2018 09:29:46 +0000 Subject: [PATCH 3/6] Done --- q01_read_data/build.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/q01_read_data/build.py b/q01_read_data/build.py index 3d7087cc..696523eb 100644 --- a/q01_read_data/build.py +++ b/q01_read_data/build.py @@ -2,7 +2,7 @@ import yaml def read_data(): - + # import the csv file into variable # You can use this path to access the CSV file: '../data/ipl_match.yaml' # Write your code here @@ -12,6 +12,8 @@ def read_data(): # return data variable return data - +read_data() +Nil=read_data() +Nil From 00e70e483c91da01a67964397271a921b97d4eec Mon Sep 17 00:00:00 2001 From: Nile28 Date: Thu, 27 Sep 2018 10:20:48 +0000 Subject: [PATCH 4/6] Done --- q02_teams/build.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/q02_teams/build.py b/q02_teams/build.py index 35cbdb8f..bfe399d5 100644 --- a/q02_teams/build.py +++ b/q02_teams/build.py @@ -2,16 +2,20 @@ # default imports from greyatomlib.python_getting_started.q01_read_data.build import read_data data = read_data() +def teams(data): + Nilesh=data['info']['teams'] + return Nilesh +teams(data) -# solution -def teams(data=data): - - # write your code here - teams =data['info']['teams'] - - return teams type(data) -data['info']['teams'] +data.keys() +data['info'] +d=data['info'] +type(d) +d.keys() +d['teams'] +Nilesh=data['info']['teams'] +Nilesh From dee4771b838407cf2013676d7b9b4f0c7e6ac036 Mon Sep 17 00:00:00 2001 From: Nile28 Date: Sat, 6 Oct 2018 11:27:48 +0000 Subject: [PATCH 5/6] Done --- q03_first_batsman/build.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/q03_first_batsman/build.py b/q03_first_batsman/build.py index 84984081..6a9ac1f7 100644 --- a/q03_first_batsman/build.py +++ b/q03_first_batsman/build.py @@ -1,13 +1,35 @@ +# %load q03_first_batsman/build.py # Default Imports from greyatomlib.python_getting_started.q01_read_data.build import read_data data = read_data() # Your Solution -def first_batsman(data=data): +def first_batsman(data): # Write your code here + batsman=data['innings'][0]['1st innings']['deliveries'][0][0.1]['batsman'] + + + return batsman + + + + + + + + + + + + + + + + + + - return name From 21e479e3f84a9b7cb99852eb32193bfa8393b4e6 Mon Sep 17 00:00:00 2001 From: Nile28 Date: Thu, 25 Oct 2018 10:32:56 +0000 Subject: [PATCH 6/6] Done --- q04_count/build.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/q04_count/build.py b/q04_count/build.py index 6cf3dcbc..6c036697 100644 --- a/q04_count/build.py +++ b/q04_count/build.py @@ -1,3 +1,4 @@ +# %load q04_count/build.py # Default Imports from greyatomlib.python_getting_started.q01_read_data.build import read_data data = read_data() @@ -6,6 +7,29 @@ def deliveries_count(data=data): # Your code here + count = 0 + deliveries = data['innings'][0]['1st innings']['deliveries'] + for delivery in deliveries: + for delivery_number, delivery_info in delivery.items(): + if delivery_info['batsman'] == 'RT Ponting': + count += 1 return count + +type (data) +data.keys() +(data ['innings']) +type (data ['innings']) +len (data ['innings']) +data ['innings'][0] +type(data ['innings'][0]) +data['innings'][0].keys() +type(data['innings'][0]['1st innings']) + +(data['innings'][0]['1st innings']).keys() +data['innings'][0]['1st innings']['deliveries'] +type(data['innings'][0]['1st innings']['deliveries']) +len(data['innings'][0]['1st innings']['deliveries']) + +