From d415d057cd1372778448fdfd411489f3922f9e00 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Fri, 28 Sep 2018 11:04:30 +0000 Subject: [PATCH 01/10] Done --- q01_read_csv_data_to_df/build.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/q01_read_csv_data_to_df/build.py b/q01_read_csv_data_to_df/build.py index 7af672f..eb40631 100644 --- a/q01_read_csv_data_to_df/build.py +++ b/q01_read_csv_data_to_df/build.py @@ -1,8 +1,19 @@ +# %load q01_read_csv_data_to_df/build.py # Default Imports import pandas as pd # Path has been given to you already to use in function. -path = "data/ipl_dataset.csv" +path = 'data/ipl_dataset.csv' # Solution +def read_csv_data_to_df(path): + read= pd.read_csv(path) + df = pd.DataFrame(read) + + + return df + + +read_csv_data_to_df(path) + From 6522bc57392b9aa1219e89958f057e1595c8b238 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Fri, 28 Sep 2018 15:47:28 +0000 Subject: [PATCH 02/10] Done --- q02_get_unique_values/build.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/q02_get_unique_values/build.py b/q02_get_unique_values/build.py index a98550a..468d887 100644 --- a/q02_get_unique_values/build.py +++ b/q02_get_unique_values/build.py @@ -1,6 +1,18 @@ +# %load q02_get_unique_values/build.py from greyatomlib.pandas_project.q01_read_csv_data_to_df.build import read_csv_data_to_df # You have been given the dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("data/ipl_dataset.csv") +ipl_df = read_csv_data_to_df('data/ipl_dataset.csv') #Solution +def get_unique_venues(): + a= ipl_df['venue'].unique() + return a + + + + + +get_unique_venues() + + From 6c2594443d59327f4def57b1b8839e77292c6a73 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 4 Oct 2018 20:52:44 +0000 Subject: [PATCH 03/10] Done --- q03_get_run_counts/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q03_get_run_counts/build.py b/q03_get_run_counts/build.py index 07a05ac..16601eb 100644 --- a/q03_get_run_counts/build.py +++ b/q03_get_run_counts/build.py @@ -1,8 +1,16 @@ +# %load q03_get_run_counts/build.py # Default Imports from greyatomlib.pandas_project.q01_read_csv_data_to_df.build import read_csv_data_to_df # You have been given the dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv") +ipl_df = read_csv_data_to_df('./data/ipl_dataset.csv') # Solution +def get_run_counts(): + a = ipl_df['runs'].value_counts() + return a + + +get_run_counts() + From d731eb2aec84cff36477182e8696e946c2c55b5c Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Sat, 6 Oct 2018 10:10:20 +0000 Subject: [PATCH 04/10] Done --- q04_get_match_specific_df/build.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/q04_get_match_specific_df/build.py b/q04_get_match_specific_df/build.py index 37ec96a..7458ecf 100644 --- a/q04_get_match_specific_df/build.py +++ b/q04_get_match_specific_df/build.py @@ -1,7 +1,17 @@ +# %load q04_get_match_specific_df/build.py from greyatomlib.pandas_project.q01_read_csv_data_to_df.build import read_csv_data_to_df # You have been given dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv") +ipl_df = read_csv_data_to_df('./data/ipl_dataset.csv') # Solution +def get_match_specific_df(match_code): + a= ipl_df[ipl_df['match_code']==598057] + + return a + + + +get_match_specific_df(598057) + From 9c024e24186a87d893219fb0e9f4799af9e1e065 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 11 Oct 2018 18:53:22 +0000 Subject: [PATCH 05/10] Done --- q05_create_bowler_filter/build.py | 12 +++++++++++- q06_get_match_innings_runs/build.py | 10 +++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/q05_create_bowler_filter/build.py b/q05_create_bowler_filter/build.py index 5c15aaa..c014e5e 100644 --- a/q05_create_bowler_filter/build.py +++ b/q05_create_bowler_filter/build.py @@ -1,7 +1,17 @@ +# %load q05_create_bowler_filter/build.py # Default imports from greyatomlib.pandas_project.q01_read_csv_data_to_df.build import read_csv_data_to_df # You have been given dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv") +ipl_df = read_csv_data_to_df('./data/ipl_dataset.csv') # Solution +def create_bowler_filter(bowler): + a= (ipl_df['bowler'] == 'I Sharma') + + print(a) + +bowler= 'I Sharma' +create_bowler_filter(bowler) + + diff --git a/q06_get_match_innings_runs/build.py b/q06_get_match_innings_runs/build.py index d938fc2..511c23e 100644 --- a/q06_get_match_innings_runs/build.py +++ b/q06_get_match_innings_runs/build.py @@ -1,11 +1,19 @@ +# %load q06_get_match_innings_runs/build.py # Default Imports from greyatomlib.pandas_project.q01_read_csv_data_to_df.build import read_csv_data_to_df # You have been given dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("data/ipl_dataset.csv") +ipl_df = read_csv_data_to_df('data/ipl_dataset.csv') # Solution +def get_match_innings_runs(): + a= (ipl_df.groupby(['match_code','inning',]).sum())['runs'] + return a + +get_match_innings_runs() + + From 65e44ddd266cb9c2bdab39535a25246727c26e8a Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 11 Oct 2018 18:57:47 +0000 Subject: [PATCH 06/10] Done --- q06_get_match_innings_runs/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/q06_get_match_innings_runs/build.py b/q06_get_match_innings_runs/build.py index 511c23e..38a5bb3 100644 --- a/q06_get_match_innings_runs/build.py +++ b/q06_get_match_innings_runs/build.py @@ -7,7 +7,7 @@ # Solution def get_match_innings_runs(): - a= (ipl_df.groupby(['match_code','inning',]).sum())['runs'] + a= (ipl_df.groupby(['match_code','inning']).sum())['runs'] return a From 01a55ec6262fa0fef173f200ec4e01556c1b3986 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 11 Oct 2018 19:09:12 +0000 Subject: [PATCH 07/10] Done --- q06_get_match_innings_runs/build.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/q06_get_match_innings_runs/build.py b/q06_get_match_innings_runs/build.py index 38a5bb3..c60a5f5 100644 --- a/q06_get_match_innings_runs/build.py +++ b/q06_get_match_innings_runs/build.py @@ -7,7 +7,7 @@ # Solution def get_match_innings_runs(): - a= (ipl_df.groupby(['match_code','inning']).sum())['runs'] + a= ipl_df.groupby(['match_code','inning']).sum()['runs'] return a From 63c2cbe0b6810a40cc4f5fbfb2fabcb07feef060 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 11 Oct 2018 19:50:01 +0000 Subject: [PATCH 08/10] Done --- q07_get_run_counts_by_match/build.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/q07_get_run_counts_by_match/build.py b/q07_get_run_counts_by_match/build.py index a18e534..80dad1d 100644 --- a/q07_get_run_counts_by_match/build.py +++ b/q07_get_run_counts_by_match/build.py @@ -1,7 +1,17 @@ +# %load q07_get_run_counts_by_match/build.py # Default Imports from greyatomlib.pandas_project.q01_read_csv_data_to_df.build import read_csv_data_to_df - +import pandas as pd # You have been give the dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv") +ipl_df = read_csv_data_to_df('./data/ipl_dataset.csv') # Solution +def get_runs_counts_by_match(): + a= ipl_df[['match_code','runs','batsman']] + b= pd.pivot_table(a, values=['runs'], index=['match_code'],columns=['runs'],aggfunc= 'count') + return b + +get_runs_counts_by_match() + + + From 1c500ec062e391df5b6c41f80c7578e36bbba54e Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 11 Oct 2018 20:03:24 +0000 Subject: [PATCH 09/10] Done --- q05_create_bowler_filter/build.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/q05_create_bowler_filter/build.py b/q05_create_bowler_filter/build.py index c014e5e..6926660 100644 --- a/q05_create_bowler_filter/build.py +++ b/q05_create_bowler_filter/build.py @@ -6,12 +6,12 @@ ipl_df = read_csv_data_to_df('./data/ipl_dataset.csv') # Solution -def create_bowler_filter(bowler): - a= (ipl_df['bowler'] == 'I Sharma') +def create_bowler_filter(bowler_name): + a= ipl_df['bowler'] == 'I Sharma' - print(a) + return a -bowler= 'I Sharma' -create_bowler_filter(bowler) +bowler_name= 'I Sharma' +create_bowler_filter(bowler_name) From 95d24d1cc1673ec9f585b8dacdd21afdc8fa38e5 Mon Sep 17 00:00:00 2001 From: PoojaTatkare Date: Thu, 11 Oct 2018 20:04:19 +0000 Subject: [PATCH 10/10] Done --- q05_create_bowler_filter/build.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/q05_create_bowler_filter/build.py b/q05_create_bowler_filter/build.py index 6926660..3846a21 100644 --- a/q05_create_bowler_filter/build.py +++ b/q05_create_bowler_filter/build.py @@ -6,12 +6,12 @@ ipl_df = read_csv_data_to_df('./data/ipl_dataset.csv') # Solution -def create_bowler_filter(bowler_name): +def create_bowler_filter(bowler): a= ipl_df['bowler'] == 'I Sharma' return a -bowler_name= 'I Sharma' -create_bowler_filter(bowler_name) +bowler= 'I Sharma' +create_bowler_filter(bowler)