From e943034c0d6a16b21741041b6ac32986a4afd2b0 Mon Sep 17 00:00:00 2001 From: avdeshmishra0214 Date: Sun, 7 Oct 2018 14:38:47 +0000 Subject: [PATCH 1/6] Done --- q01_read_csv_data_to_df/build.py | 8 +++++++- 1 file changed, 7 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..298d32b 100644 --- a/q01_read_csv_data_to_df/build.py +++ b/q01_read_csv_data_to_df/build.py @@ -1,8 +1,14 @@ +# %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): + return (pd.read_csv(path)) + +pd.read_csv('data/ipl_dataset.csv') + From 9fac8bce50d8557a4ceb5e4d3a3ec7d8e7cf6efd Mon Sep 17 00:00:00 2001 From: avdeshmishra0214 Date: Sun, 7 Oct 2018 14:46:06 +0000 Subject: [PATCH 2/6] Done --- q02_get_unique_values/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q02_get_unique_values/build.py b/q02_get_unique_values/build.py index a98550a..81e377d 100644 --- a/q02_get_unique_values/build.py +++ b/q02_get_unique_values/build.py @@ -1,6 +1,13 @@ +# %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(): + return (ipl_df['venue'].unique()) + + + From fa6d7fce81311940946dca1051c1549bf5aa280b Mon Sep 17 00:00:00 2001 From: avdeshmishra0214 Date: Sun, 7 Oct 2018 15:02:56 +0000 Subject: [PATCH 3/6] Done --- q03_get_run_counts/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q03_get_run_counts/build.py b/q03_get_run_counts/build.py index 07a05ac..6bb6fd3 100644 --- a/q03_get_run_counts/build.py +++ b/q03_get_run_counts/build.py @@ -1,8 +1,15 @@ +# %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') + +#ipl_df['count'] = 1 # Solution +def get_run_counts(): + return(ipl_df['runs'].value_counts()) +get_run_counts() + From c26d7baf15782ce8dee627495c3a6cd71e43e3b4 Mon Sep 17 00:00:00 2001 From: avdeshmishra0214 Date: Sun, 7 Oct 2018 15:13:17 +0000 Subject: [PATCH 4/6] Done --- q04_get_match_specific_df/build.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/q04_get_match_specific_df/build.py b/q04_get_match_specific_df/build.py index 37ec96a..ce26d23 100644 --- a/q04_get_match_specific_df/build.py +++ b/q04_get_match_specific_df/build.py @@ -1,7 +1,12 @@ +# %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): + return (ipl_df[ipl_df['match_code'] == int(match_code)]) + + From c0af15f5c2907178166d838b58ead68a4c47c368 Mon Sep 17 00:00:00 2001 From: avdeshmishra0214 Date: Sun, 7 Oct 2018 15:21:57 +0000 Subject: [PATCH 5/6] Done --- q05_create_bowler_filter/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q05_create_bowler_filter/build.py b/q05_create_bowler_filter/build.py index 5c15aaa..65f6335 100644 --- a/q05_create_bowler_filter/build.py +++ b/q05_create_bowler_filter/build.py @@ -1,7 +1,14 @@ +# %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(bowlern): + return (ipl_df['bowler'] == bowlern) + + From 92fe9513c07e0ef5d0e0799e6bae4e98e5268c4f Mon Sep 17 00:00:00 2001 From: avdeshmishra0214 Date: Sun, 7 Oct 2018 16:18:55 +0000 Subject: [PATCH 6/6] Done --- q06_get_match_innings_runs/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q06_get_match_innings_runs/build.py b/q06_get_match_innings_runs/build.py index d938fc2..299c5c9 100644 --- a/q06_get_match_innings_runs/build.py +++ b/q06_get_match_innings_runs/build.py @@ -1,11 +1,18 @@ +# %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') + + +#ipl_df['runs'].sum() # Solution +def get_match_innings_runs(): + return(ipl_df.groupby(['match_code','inning'])['runs'].sum()) +