From 00b490ae2411e8926af3aa0cc05eebee6342563d Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Sat, 8 Sep 2018 16:36:01 +0000 Subject: [PATCH 1/8] Done --- q01_zeros_array/build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/q01_zeros_array/build.py b/q01_zeros_array/build.py index 5501f7a..05d44d9 100644 --- a/q01_zeros_array/build.py +++ b/q01_zeros_array/build.py @@ -1,3 +1,4 @@ +# %load q01_zeros_array/build.py # Default Imports import sys, os sys.path.append(os.path.join(os.path.dirname(os.curdir), '..' )) @@ -5,4 +6,12 @@ # Your solution +def array_zeros(): + zeros_array = np.zeros((3,4,2)) + + return zeros_array + + + + From 8a6c5c32069efa3aef3b33d59b63e7948aff3ce4 Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Sat, 8 Sep 2018 16:48:17 +0000 Subject: [PATCH 2/8] Done --- q02_zeros_reshaped/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q02_zeros_reshaped/build.py b/q02_zeros_reshaped/build.py index ed629c7..f93b40f 100644 --- a/q02_zeros_reshaped/build.py +++ b/q02_zeros_reshaped/build.py @@ -1,5 +1,13 @@ +# %load q02_zeros_reshaped/build.py # Default imports import numpy as np -from greyatomlib.python_intermediate.q01_zeros_array.build import array_zeros +from greyatomlib.python_intermediate.q01_zeros_array.build import array_zeros # Write your code +def array_reshaped_zeros(): + zeros_array_reshaped = array_zeros().reshape(2,3,4) + + return zeros_array_reshaped + + + From 378735a7807b1be5c5c2e6290d3ee64a279934fd Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Sun, 9 Sep 2018 03:44:13 +0000 Subject: [PATCH 3/8] Done --- q03_create_3d_array/build.py | 14 +++++++++++++- q04_read_csv_data_to_ndarray/build.py | 14 ++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7bb6e2f..7e61341 100644 --- a/q03_create_3d_array/build.py +++ b/q03_create_3d_array/build.py @@ -1,4 +1,16 @@ +# %load q03_create_3d_array/build.py # Default Imports import numpy as np -# Enter solution here \ No newline at end of file +# Enter solution here + +def create_3d_array(): + N = np.arange(27) + array = np.array(N) + array = array.reshape(3,3,3) + + return create_3d_array + + + + diff --git a/q04_read_csv_data_to_ndarray/build.py b/q04_read_csv_data_to_ndarray/build.py index fb71e6e..372b05e 100644 --- a/q04_read_csv_data_to_ndarray/build.py +++ b/q04_read_csv_data_to_ndarray/build.py @@ -1,5 +1,15 @@ +# %load q04_read_csv_data_to_ndarray/build.py # Default Imports import numpy as np -path = "./data/ipl_matches_small.csv" +path = '../data/ipl_matches_small.csv' + +def read_csv_data_to_ndarray(path,dtype = np.float64): + load = np.genfromtxt(path,dtype =dtype, skip_header=1, delimiter=',') + #load = np.array(load) + return load + +# Enter code here +#type(read_csv_data_to_ndarray('./data/ipl_matches_small.csv')) + + -# Enter code here \ No newline at end of file From fe6e9d58bc99c90fd4a7dd9a4f4e5f1707496bbb Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Sun, 9 Sep 2018 04:13:54 +0000 Subject: [PATCH 4/8] Done --- q05_read_csv_data/build.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/q05_read_csv_data/build.py b/q05_read_csv_data/build.py index 5c70e6e..984dae5 100644 --- a/q05_read_csv_data/build.py +++ b/q05_read_csv_data/build.py @@ -1,4 +1,14 @@ +# %load q05_read_csv_data/build.py # Default imports import numpy as np +path = './data/ipl_matches_small.csv' + +# Enter code here +def read_ipl_data_csv(path,dtype =np.float64): + ipl_matches_array = np.genfromtxt(path,dtype ='S50',skip_header = 1 , delimiter=',') + return ipl_matches_array + + +#type(read_ipl_data_csv(path)) + -# Enter code here \ No newline at end of file From fc096999b3ce11731ebc1e56aad09a33646bf54d Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Sun, 9 Sep 2018 14:46:08 +0000 Subject: [PATCH 5/8] Done --- q06_get_unique_matches_count/build.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/q06_get_unique_matches_count/build.py b/q06_get_unique_matches_count/build.py index 014497e..cf8e010 100644 --- a/q06_get_unique_matches_count/build.py +++ b/q06_get_unique_matches_count/build.py @@ -1,5 +1,15 @@ +# %load q06_get_unique_matches_count/build.py # Default imports from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv path = 'data/ipl_matches_small.csv' - +import numpy as np # Enter Code Here +def get_unique_matches_count(): + ipl_matches_array = len(np.unique(read_ipl_data_csv('data/ipl_matches_small.csv','S50')[:,0])) + return ipl_matches_array + + + +#get_unique_matches_count() + + From 5102bcea728a6ab12162d84064355b13a60a365c Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Sun, 9 Sep 2018 15:01:37 +0000 Subject: [PATCH 6/8] Done --- q07_get_unique_teams_set/build.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/q07_get_unique_teams_set/build.py b/q07_get_unique_teams_set/build.py index 17fefd2..2ebca85 100644 --- a/q07_get_unique_teams_set/build.py +++ b/q07_get_unique_teams_set/build.py @@ -1,5 +1,17 @@ +# %load q07_get_unique_teams_set/build.py # Default imports from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv -path = "data/ipl_matches_small.csv" - +path = 'data/ipl_matches_small.csv' +import numpy as np # Enter Code Here +def get_unique_teams_set(): + team1 = np.unique(read_ipl_data_csv('data/ipl_matches_small.csv','S50')[:,3]) + team2 = np.unique(read_ipl_data_csv('data/ipl_matches_small.csv','S50')[:,4]) + all_teams = set(np.unique(np.concatenate((team1,team2),axis=0))) + + return all_teams + + +#get_unique_teams_set() + + From 0c5ad87007b14eb270e375cd7ac1cceaa22e09fe Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Sun, 9 Sep 2018 16:40:10 +0000 Subject: [PATCH 7/8] Done --- q08_get_total_extras/build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/q08_get_total_extras/build.py b/q08_get_total_extras/build.py index 95890c1..eb7a394 100644 --- a/q08_get_total_extras/build.py +++ b/q08_get_total_extras/build.py @@ -1,7 +1,16 @@ +# %load q08_get_total_extras/build.py # Default Imports from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv import numpy as np path = 'data/ipl_matches_small.csv' -# Enter Code Here \ No newline at end of file +# Enter Code Here +def get_total_extras() : + file1 = np.sum(np.genfromtxt(path,skip_header = 1 , delimiter=',')[:,-6],axis=0) + return file1 + + + + + From d4117e39ebfa154b3816a79fd4149e2aa66d57dd Mon Sep 17 00:00:00 2001 From: dhananjay93 Date: Wed, 19 Sep 2018 13:02:14 +0000 Subject: [PATCH 8/8] Done --- q03_create_3d_array/build.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7e61341..04f1dbc 100644 --- a/q03_create_3d_array/build.py +++ b/q03_create_3d_array/build.py @@ -6,10 +6,9 @@ def create_3d_array(): N = np.arange(27) - array = np.array(N) - array = array.reshape(3,3,3) - - return create_3d_array + np.array(N) + N = N.reshape(3,3,3) + return N