From 1a10a84ae6055d2347b755606760612ce8add1b1 Mon Sep 17 00:00:00 2001 From: Lavi1920 Date: Sat, 29 Sep 2018 13:58:38 +0000 Subject: [PATCH 1/5] Done --- q01_read_csv_data_to_df/build.py | 12 +++++++++++- 1 file changed, 11 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..4b113f6 100644 --- a/q01_read_csv_data_to_df/build.py +++ b/q01_read_csv_data_to_df/build.py @@ -1,8 +1,18 @@ +# %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): + df = pd.read_csv(path) + return df + + + + + From f6e35a463a92616288b561bd75ea07eaaa0fee48 Mon Sep 17 00:00:00 2001 From: Lavi1920 Date: Tue, 2 Oct 2018 13:26:52 +0000 Subject: [PATCH 2/5] Done --- q02_get_unique_values/build.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/q02_get_unique_values/build.py b/q02_get_unique_values/build.py index a98550a..47bad45 100644 --- a/q02_get_unique_values/build.py +++ b/q02_get_unique_values/build.py @@ -1,6 +1,20 @@ +# %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 +#ipl_df.head() +def get_unique_venues(): + x=ipl_df['venue'].unique() + return x + + +get_unique_venues() + + + + + + From ad2b687b6aa7ed46d8f8100a02086975110a1f4b Mon Sep 17 00:00:00 2001 From: Lavi1920 Date: Tue, 2 Oct 2018 15:45:11 +0000 Subject: [PATCH 3/5] Done --- q03_get_run_counts/build.py | 14 ++++++++++++-- q04_get_match_specific_df/build.py | 14 +++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/q03_get_run_counts/build.py b/q03_get_run_counts/build.py index 07a05ac..7c072bb 100644 --- a/q03_get_run_counts/build.py +++ b/q03_get_run_counts/build.py @@ -1,8 +1,18 @@ +# %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 - +import pandas as pd # You have been given the dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv") +df = read_csv_data_to_df('./data/ipl_dataset.csv') # Solution +count=0 +def get_run_counts(): + series = pd.Series(df['runs']+count) + return series + +get_run_counts() + + + diff --git a/q04_get_match_specific_df/build.py b/q04_get_match_specific_df/build.py index 37ec96a..bd483b2 100644 --- a/q04_get_match_specific_df/build.py +++ b/q04_get_match_specific_df/build.py @@ -1,7 +1,19 @@ +# %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 +import numpy as np +import pandas as pd + +def get_match_specific_df(match_code): + return ipl_df[:][ipl_df['match_code'] == match_code] +get_match_specific_df(392202) + + + + + From 86896dfeef08463fe2a5198db20b69a9de26e289 Mon Sep 17 00:00:00 2001 From: Lavi1920 Date: Tue, 2 Oct 2018 15:53:14 +0000 Subject: [PATCH 4/5] Done --- q05_create_bowler_filter/build.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/q05_create_bowler_filter/build.py b/q05_create_bowler_filter/build.py index 5c15aaa..0b08c73 100644 --- a/q05_create_bowler_filter/build.py +++ b/q05_create_bowler_filter/build.py @@ -1,7 +1,19 @@ +# %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 +import pandas as pd +import numpy as np +def create_bowler_filter(bowler): + return (ipl_df['bowler']==bowler) + + + + + + + From 910cc24eac5cfb858b3308cce04ff8ff282fafe8 Mon Sep 17 00:00:00 2001 From: Lavi1920 Date: Wed, 3 Oct 2018 13:23:15 +0000 Subject: [PATCH 5/5] Done --- q06_get_match_innings_runs/build.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/q06_get_match_innings_runs/build.py b/q06_get_match_innings_runs/build.py index d938fc2..1ad20b5 100644 --- a/q06_get_match_innings_runs/build.py +++ b/q06_get_match_innings_runs/build.py @@ -1,11 +1,17 @@ +# %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 - +import pandas as pd # You have been given dataset already in 'ipl_df'. -ipl_df = read_csv_data_to_df("data/ipl_dataset.csv") +df = read_csv_data_to_df('data/ipl_dataset.csv') # Solution +def get_match_innings_runs(): + x=df.groupby(['match_code','inning'])['runs'].sum() +#g=df.groupby('inning') + return x +get_match_innings_runs()