From dc8585dfb5d9d624ef5ddf915f9b3216e39ca86c Mon Sep 17 00:00:00 2001 From: himadri79 Date: Tue, 2 Oct 2018 17:04:44 +0000 Subject: [PATCH 1/6] Done --- q01_zeros_array/build.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/q01_zeros_array/build.py b/q01_zeros_array/build.py index 5501f7a..de8bca8 100644 --- a/q01_zeros_array/build.py +++ b/q01_zeros_array/build.py @@ -1,8 +1,14 @@ +# %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 +array_zeros() +#please make sure you save and run the code before test From f2adb20a8f0918d1ddecb57fc42c110ffc902be4 Mon Sep 17 00:00:00 2001 From: himadri79 Date: Tue, 2 Oct 2018 17:11:31 +0000 Subject: [PATCH 2/6] Done --- q02_zeros_reshaped/build.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/q02_zeros_reshaped/build.py b/q02_zeros_reshaped/build.py index ed629c7..c800cfc 100644 --- a/q02_zeros_reshaped/build.py +++ b/q02_zeros_reshaped/build.py @@ -1,5 +1,19 @@ +# %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 +def array_zeroes(): + zeros_array = np.zeros((3,4,2)) + return zeros_array +def array_reshaped_zeros(): + zeros_array_reshaped = np.zeros((2,3,4)) + return zeros_array_reshaped +print('Zero arrays with dimension(3,4,2)') +print(array_zeros()) +print(' ') +print('Zero arrays after Reshape with dimensions (2,3,4)') +print(array_reshaped_zeros()) + + From 2de6eebe229bcd97f98780fc327bd15cb3abacc8 Mon Sep 17 00:00:00 2001 From: himadri79 Date: Tue, 2 Oct 2018 17:14:52 +0000 Subject: [PATCH 3/6] Done --- q03_create_3d_array/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7bb6e2f..f45d0d0 100644 --- a/q03_create_3d_array/build.py +++ b/q03_create_3d_array/build.py @@ -1,4 +1,12 @@ +# %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 = 3**3 + array = np.array(range(n)).reshape((3,3,3)) + return array +create_3d_array() + + From f3b8e189cf7d93868b4d5451717e5b1ecfa476ca Mon Sep 17 00:00:00 2001 From: himadri79 Date: Tue, 2 Oct 2018 18:30:28 +0000 Subject: [PATCH 4/6] Done --- q06_get_unique_matches_count/build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/q06_get_unique_matches_count/build.py b/q06_get_unique_matches_count/build.py index 014497e..8d88351 100644 --- a/q06_get_unique_matches_count/build.py +++ b/q06_get_unique_matches_count/build.py @@ -1,5 +1,14 @@ +# %load q06_get_unique_matches_count/build.py # Default imports +import numpy as np from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv path = 'data/ipl_matches_small.csv' # Enter Code Here +def get_unique_matches_count(): + ipl_matches_array = read_ipl_data_csv(path, dtype = '|S100') + ipl_matches_array = np.unique(ipl_matches_array[1:,1]) + return len(ipl_matches_array) +get_unique_matches_count() + + From f501cd0ddf5f6c9a2fca3603f053835be7e6a8dd Mon Sep 17 00:00:00 2001 From: himadri79 Date: Tue, 2 Oct 2018 18:35:11 +0000 Subject: [PATCH 5/6] Done --- q07_get_unique_teams_set/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q07_get_unique_teams_set/build.py b/q07_get_unique_teams_set/build.py index 17fefd2..b99e2ac 100644 --- a/q07_get_unique_teams_set/build.py +++ b/q07_get_unique_teams_set/build.py @@ -1,5 +1,13 @@ +# %load q07_get_unique_teams_set/build.py # Default imports +import numpy as np 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' # Enter Code Here +def get_unique_teams_set(): + array = read_ipl_data_csv(path, dtype = '|S100') + return set(np.unique(array[:, 3:5])) +get_unique_teams_set() + + From fa5969379a89029d77dc393a5183a4e7b535724c Mon Sep 17 00:00:00 2001 From: himadri79 Date: Tue, 2 Oct 2018 18:39:37 +0000 Subject: [PATCH 6/6] Done --- q08_get_total_extras/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q08_get_total_extras/build.py b/q08_get_total_extras/build.py index 95890c1..bb92c7f 100644 --- a/q08_get_total_extras/build.py +++ b/q08_get_total_extras/build.py @@ -1,7 +1,15 @@ +# %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(): + array = read_ipl_data_csv(path,dtype = '|S50') + sum = np.array(array[:,17:18],dtype = int).sum() + return sum +get_total_extras() + +