From 469659966b50e563d532c58aec1205975a5aa2ea Mon Sep 17 00:00:00 2001 From: Rynston Date: Sat, 28 Jul 2018 17:30:24 +0000 Subject: [PATCH 1/8] Done --- q01_zeros_array/build.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/q01_zeros_array/build.py b/q01_zeros_array/build.py index 5501f7a..6a3c5cd 100644 --- a/q01_zeros_array/build.py +++ b/q01_zeros_array/build.py @@ -1,8 +1,21 @@ +# %load q01_zeros_array/build.py # Default Imports import sys, os sys.path.append(os.path.join(os.path.dirname(os.curdir), '..' )) import numpy as np # Your solution +def array_zeros(): + + zeros_array = np.zeros((3,4,2)) + return zeros_array + + + + + + + + From 97e988c293a9f0bf59905560e531c5c1e463bca3 Mon Sep 17 00:00:00 2001 From: Rynston Date: Sat, 28 Jul 2018 18:14:30 +0000 Subject: [PATCH 2/8] Done --- q02_zeros_reshaped/build.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/q02_zeros_reshaped/build.py b/q02_zeros_reshaped/build.py index ed629c7..2061aa1 100644 --- a/q02_zeros_reshaped/build.py +++ b/q02_zeros_reshaped/build.py @@ -1,5 +1,21 @@ +# %load q02_zeros_reshaped/build.py # Default imports import numpy as np from greyatomlib.python_intermediate.q01_zeros_array.build import array_zeros -# Write your code + + +# Your solution +def array_reshaped_zeros(): + + zeros_array = np.zeros((3,4,2)) + zeros_array_reshaped = np.reshape(zeros_array,(2,3,4)) + # print (zeros_array_reshaped) + + return zeros_array_reshaped + + + + + + From dfeb27db9ffb6ab9abdc2087dc68adbb8c32f7d3 Mon Sep 17 00:00:00 2001 From: Rynston Date: Sun, 29 Jul 2018 17:24:06 +0000 Subject: [PATCH 3/8] Done --- q04_read_csv_data_to_ndarray/build.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/q04_read_csv_data_to_ndarray/build.py b/q04_read_csv_data_to_ndarray/build.py index fb71e6e..85776ee 100644 --- a/q04_read_csv_data_to_ndarray/build.py +++ b/q04_read_csv_data_to_ndarray/build.py @@ -1,5 +1,9 @@ # 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): + return np.genfromtxt(path, dtype=dtype, skip_header=1, delimiter=',') + + -# Enter code here \ No newline at end of file From e733127a455ba35187398d0f7416cd5330507776 Mon Sep 17 00:00:00 2001 From: Rynston Date: Mon, 30 Jul 2018 05:54:20 +0000 Subject: [PATCH 4/8] Done --- q05_read_csv_data/build.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/q05_read_csv_data/build.py b/q05_read_csv_data/build.py index 5c70e6e..28a1c95 100644 --- a/q05_read_csv_data/build.py +++ b/q05_read_csv_data/build.py @@ -1,4 +1,17 @@ -# Default imports +# %load q05_read_csv_data/build.py + + +# Default Imports import numpy as np +path = './data/ipl_matches_small.csv' + +def read_ipl_data_csv(path, dtype=np.float64): + ipl_matches_array = np.genfromtxt(path, dtype=dtype, skip_header=1, delimiter=',') + return ipl_matches_array + +read_ipl_data_csv(path) + + + + -# Enter code here \ No newline at end of file From 866f6b9dc5941f6b86335c45451c9f719e59d6fe Mon Sep 17 00:00:00 2001 From: Rynston Date: Mon, 30 Jul 2018 06:04:31 +0000 Subject: [PATCH 5/8] Done --- q03_create_3d_array/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7bb6e2f..18110a3 100644 --- a/q03_create_3d_array/build.py +++ b/q03_create_3d_array/build.py @@ -1,4 +1,11 @@ +# %load q03_create_3d_array/build.py # Default Imports import numpy as np +# Enter solution here +def create_3d_array(): + ndarr=np.arange(27) + ndarr.shape=(3,3,3) + return ndarr + + -# Enter solution here \ No newline at end of file From f05344a4d91820ca028a9cd9c087fcabf4083d31 Mon Sep 17 00:00:00 2001 From: Rynston Date: Mon, 30 Jul 2018 06:46:27 +0000 Subject: [PATCH 6/8] Done --- q07_get_unique_teams_set/build.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/q07_get_unique_teams_set/build.py b/q07_get_unique_teams_set/build.py index 17fefd2..daee68a 100644 --- a/q07_get_unique_teams_set/build.py +++ b/q07_get_unique_teams_set/build.py @@ -1,5 +1,14 @@ +# %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(): + arr= read_ipl_data_csv(path,'|S100') + team1= np.unique(arr[:,3:4]) + team2= np.unique(arr[:,4:5]) + return set(np.union1d(team1,team2)) + + + From dd4a6e0b88749030317a33faaa0b59a72f4df36e Mon Sep 17 00:00:00 2001 From: Rynston Date: Mon, 30 Jul 2018 07:00:06 +0000 Subject: [PATCH 7/8] Done --- q08_get_total_extras/build.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/q08_get_total_extras/build.py b/q08_get_total_extras/build.py index 95890c1..0816121 100644 --- a/q08_get_total_extras/build.py +++ b/q08_get_total_extras/build.py @@ -1,7 +1,14 @@ +# %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(): + arr=read_ipl_data_csv(path,np.int64) + return arr[:,17:18].sum() + + + From abf3c9abb179ae7f33e37cf3ef96f3b906d89063 Mon Sep 17 00:00:00 2001 From: Rynston Date: Mon, 30 Jul 2018 10:33:17 +0000 Subject: [PATCH 8/8] Done --- q06_get_unique_matches_count/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q06_get_unique_matches_count/build.py b/q06_get_unique_matches_count/build.py index 014497e..85f8614 100644 --- a/q06_get_unique_matches_count/build.py +++ b/q06_get_unique_matches_count/build.py @@ -1,5 +1,13 @@ +# %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=read_ipl_data_csv(path,'|S100') + ipl_matches_array=ipl_matches_array[:,0:1] + return np.unique(ipl_matches_array).size + + +