From bb979fbe56d9eda6fa5ee1f7d4e7f1f30a957012 Mon Sep 17 00:00:00 2001 From: mario-the-legend Date: Tue, 2 Oct 2018 14:05:50 +0000 Subject: [PATCH 1/4] Done --- q01_read_csv_data_to_df/build.py | 9 ++++++++- 1 file changed, 8 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..4ead533 100644 --- a/q01_read_csv_data_to_df/build.py +++ b/q01_read_csv_data_to_df/build.py @@ -1,8 +1,15 @@ +# %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) + + +read_csv_data_to_df('data/ipl_dataset.csv') + From ae9037d35dd6716ddd8d7402288ace2ddf3753d9 Mon Sep 17 00:00:00 2001 From: mario-the-legend Date: Tue, 2 Oct 2018 14:18:11 +0000 Subject: [PATCH 2/4] 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..52d6194 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 +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") +ipl_df = read_csv_data_to_df('data/ipl_dataset.csv') #Solution +def get_unique_venues(): + return ipl_df['venue'].unique() +get_unique_venues() + + From 089fd70745c03a8a967f9e452d8b0259fa220915 Mon Sep 17 00:00:00 2001 From: mario-the-legend Date: Tue, 2 Oct 2018 15:10:53 +0000 Subject: [PATCH 3/4] Done --- q03_get_run_counts/build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/q03_get_run_counts/build.py b/q03_get_run_counts/build.py index 07a05ac..53c1b88 100644 --- a/q03_get_run_counts/build.py +++ b/q03_get_run_counts/build.py @@ -1,8 +1,17 @@ +# %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(): + return ipl_df['runs'].value_counts() + + + + +get_run_counts() + From cfb781459953c374193a222b4a8acfe67be206aa Mon Sep 17 00:00:00 2001 From: mario-the-legend Date: Mon, 8 Oct 2018 08:53:43 +0000 Subject: [PATCH 4/4] Done --- q04_get_match_specific_df/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q04_get_match_specific_df/build.py b/q04_get_match_specific_df/build.py index 37ec96a..7aa7c12 100644 --- a/q04_get_match_specific_df/build.py +++ b/q04_get_match_specific_df/build.py @@ -1,7 +1,14 @@ +# %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 +import pandas as pd # 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'].astype(int) == match_code)] + +get_match_specific_df(392203) +