From 785308911f249e3956a6ffe78112f207195d3e26 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Fri, 28 Sep 2018 15:23:29 +0000 Subject: [PATCH 1/7] Done --- q01_get_total_deliveries_players/build.py | 24 ++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/q01_get_total_deliveries_players/build.py b/q01_get_total_deliveries_players/build.py index 2bc0f30..033630f 100644 --- a/q01_get_total_deliveries_players/build.py +++ b/q01_get_total_deliveries_players/build.py @@ -1,7 +1,29 @@ +# %load q01_get_total_deliveries_players/build.py # Default imports import numpy as np +import pandas as pd -ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",") +ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',') # Your Solution +def get_total_deliveries_played(batsman): + a= ipl_matches_array[:,13] + b = a==b'SR Tendulkar' + c = a[b] + return len(c) + + + + + + + + + + + + +get_total_deliveries_played(b'SR Tendulkar') + + From b7d268eb873507b43664df4bb5811f3aac6dd089 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Fri, 28 Sep 2018 16:53:34 +0000 Subject: [PATCH 2/7] Done --- q02_get_wicket_delivery_numbers_array/build.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/q02_get_wicket_delivery_numbers_array/build.py b/q02_get_wicket_delivery_numbers_array/build.py index 47401a5..9ec7886 100644 --- a/q02_get_wicket_delivery_numbers_array/build.py +++ b/q02_get_wicket_delivery_numbers_array/build.py @@ -1,7 +1,18 @@ +# %load q02_get_wicket_delivery_numbers_array/build.py #Default Imports import numpy as np -ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",") +ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',') #Your Solution +def get_wicket_delivery_numbers_array(player): + player_out = ipl_matches_array[:,20] + deliveriers = ipl_matches_array[:,11] + a = (deliveriers [player_out== player]) + return a + + + +get_wicket_delivery_numbers_array(b'ST Jayasuriya') + From e1a5725d4d99a7a6d4f9c5db1aadc024d043f149 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Fri, 28 Sep 2018 17:14:55 +0000 Subject: [PATCH 3/7] Done --- q03_get_toss_win_count/build.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/q03_get_toss_win_count/build.py b/q03_get_toss_win_count/build.py index d0f09a9..1385159 100644 --- a/q03_get_toss_win_count/build.py +++ b/q03_get_toss_win_count/build.py @@ -1,7 +1,17 @@ +# %load q03_get_toss_win_count/build.py #Default Imports import numpy as np -ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",") +ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',') #Your Solution +def get_toss_win_count(team): + team1 = np.unique(ipl_matches_array[:,4]) + team2= np.unique(ipl_matches_array[:,5]) + win_toss= ipl_matches_array[:,6] + a = len(team1[team1== team]) + b= len(team2[team2== team]) + return (a+b) +get_toss_win_count(b'Mumbai Indians') + From 2fc691c8dab67a75984fbcf447c1c9a7315a3830 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 4 Oct 2018 19:48:03 +0000 Subject: [PATCH 4/7] Done --- q03_get_toss_win_count/build.py | 5 +++-- q04_get_all_sixes_filter/build.py | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/q03_get_toss_win_count/build.py b/q03_get_toss_win_count/build.py index 1385159..20b8c67 100644 --- a/q03_get_toss_win_count/build.py +++ b/q03_get_toss_win_count/build.py @@ -9,8 +9,9 @@ def get_toss_win_count(team): team1 = np.unique(ipl_matches_array[:,4]) team2= np.unique(ipl_matches_array[:,5]) win_toss= ipl_matches_array[:,6] - a = len(team1[team1== team]) - b= len(team2[team2== team]) + a =len(team1[team1==team ]) + b= len(team2[team2==team]) + return (a+b) get_toss_win_count(b'Mumbai Indians') diff --git a/q04_get_all_sixes_filter/build.py b/q04_get_all_sixes_filter/build.py index d0f09a9..6695ea2 100644 --- a/q04_get_all_sixes_filter/build.py +++ b/q04_get_all_sixes_filter/build.py @@ -1,7 +1,15 @@ +# %load q04_get_all_sixes_filter/build.py #Default Imports import numpy as np -ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",") +ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',') #Your Solution +def get_all_sixes_filter(): + a = ipl_matches_array[:,16].astype(np.int16) + b = np.array(filter(lambda x:x==6, a)) + c = a==6 + return c +get_all_sixes_filter() + From 6eed625f89a2bda762b276f177db2f8130fd5cac Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 4 Oct 2018 19:52:02 +0000 Subject: [PATCH 5/7] Done --- q04_get_all_sixes_filter/build.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/q04_get_all_sixes_filter/build.py b/q04_get_all_sixes_filter/build.py index 6695ea2..f17dd4e 100644 --- a/q04_get_all_sixes_filter/build.py +++ b/q04_get_all_sixes_filter/build.py @@ -6,10 +6,10 @@ #Your Solution def get_all_sixes_filter(): - a = ipl_matches_array[:,16].astype(np.int16) - b = np.array(filter(lambda x:x==6, a)) - c = a==6 - return c + a = ipl_matches_array[:,16].astype(np.int16) == 6 + + + return a get_all_sixes_filter() From 9f8875a6528aa8221aab2e225893a070799eaa39 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 4 Oct 2018 19:56:29 +0000 Subject: [PATCH 6/7] Done --- q05_create_delivery_series/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q05_create_delivery_series/build.py b/q05_create_delivery_series/build.py index fcc1b8a..f4e2b4b 100644 --- a/q05_create_delivery_series/build.py +++ b/q05_create_delivery_series/build.py @@ -1,7 +1,15 @@ +# %load q05_create_delivery_series/build.py #Default Imports import pandas as pd import numpy as np -ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",") +ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',') #Your Solution +def create_delivery_series(): + a= pd.Series(ipl_matches_array[:, 11]) + return a + + + +create_delivery_series() From b505bea5e2c575e2206d45bd6d045002a973a26c Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 4 Oct 2018 20:17:24 +0000 Subject: [PATCH 7/7] Done --- q06_create_runs_series/build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/q06_create_runs_series/build.py b/q06_create_runs_series/build.py index fcc1b8a..bf575e5 100644 --- a/q06_create_runs_series/build.py +++ b/q06_create_runs_series/build.py @@ -1,7 +1,16 @@ +# %load q06_create_runs_series/build.py #Default Imports import pandas as pd import numpy as np -ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",") +ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',') #Your Solution +def create_runs_series(match_code): + a= pd.Series(ipl_matches_array[:,11]) + b= pd.Series(ipl_matches_array[:,16], index= a) + + return b + +create_runs_series(b'392203') +