From efad127b4b7f5f732344c3ef775a5dd5fd77eab3 Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Wed, 12 Sep 2018 10:00:51 +0000 Subject: [PATCH 1/9] Done --- q01_zeros_array/build.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/q01_zeros_array/build.py b/q01_zeros_array/build.py index 5501f7a..5cd663a 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,10 @@ # Your solution +def array_zeros(): + + zeros_array = np.zeros((3,4,2), dtype=float) + return zeros_array + + From e8b7dbfc28467ea138ce270105cee6a30ab233da Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Wed, 12 Sep 2018 10:41:53 +0000 Subject: [PATCH 2/9] 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..f679f27 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_reshaped_zeros(): + + zeros_array = np.zeros((3,4,2), dtype=int) + zeros_array_reshaped = zeros_array.reshape(2,3,4) + return zeros_array_reshaped + + +array_reshaped_zeros() + + + From ae893db8dd3172eb2a675a57d7cdadbebaecc389 Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Wed, 12 Sep 2018 11:03:10 +0000 Subject: [PATCH 3/9] Done --- q03_create_3d_array/build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7bb6e2f..083a432 100644 --- a/q03_create_3d_array/build.py +++ b/q03_create_3d_array/build.py @@ -1,4 +1,13 @@ +# %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(): + + arr = np.arange(27).reshape(3,3,3) + return arr + + + From 645914f1e79ff27e35cc31ef1c23645f1a32b32a Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Thu, 13 Sep 2018 03:11:24 +0000 Subject: [PATCH 4/9] Done --- q04_read_csv_data_to_ndarray/build.py | 13 +++++++++++-- 1 file changed, 11 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..a9557f8 100644 --- a/q04_read_csv_data_to_ndarray/build.py +++ b/q04_read_csv_data_to_ndarray/build.py @@ -1,5 +1,14 @@ +# %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' + +# Enter code here +def read_csv_data_to_ndarray(path, dt=np.float64): + + arr = np.genfromtxt(path, delimiter=',', dtype=dt, skip_header=1) + + return arr + + -# Enter code here \ No newline at end of file From da025442ab0f758c513e6d694851fd91eb78acdf Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Thu, 13 Sep 2018 03:45:58 +0000 Subject: [PATCH 5/9] Done --- q04_read_csv_data_to_ndarray/build.py | 1 + 1 file changed, 1 insertion(+) diff --git a/q04_read_csv_data_to_ndarray/build.py b/q04_read_csv_data_to_ndarray/build.py index a9557f8..e9a8c12 100644 --- a/q04_read_csv_data_to_ndarray/build.py +++ b/q04_read_csv_data_to_ndarray/build.py @@ -10,5 +10,6 @@ def read_csv_data_to_ndarray(path, dt=np.float64): return arr +read_csv_data_to_ndarray(path) From 5f040cefc7b9d0c34a5ac3b9241372b71b016f96 Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Fri, 14 Sep 2018 03:42:17 +0000 Subject: [PATCH 6/9] Done --- q05_read_csv_data/build.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/q05_read_csv_data/build.py b/q05_read_csv_data/build.py index 5c70e6e..92e6d48 100644 --- a/q05_read_csv_data/build.py +++ b/q05_read_csv_data/build.py @@ -1,4 +1,21 @@ +# %load q05_read_csv_data/build.py # Default imports + import numpy as np -# Enter code here \ No newline at end of file +path = './data/ipl_matches_small.csv' + +def read_ipl_data_csv(path, dtype=np.float64): + + arr = np.genfromtxt(path, delimiter=',', dtype = dtype , skip_header=1) + ipl_matches_array = arr[:,:].astype('|S50') + print(type(ipl_matches_array)) + return ipl_matches_array + +read_ipl_data_csv(path, dtype=np.float64) + + + + + + From 7391738959b28aad8fa80c2b156c55026fe45626 Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Wed, 19 Sep 2018 05:39:39 +0000 Subject: [PATCH 7/9] Done --- q06_get_unique_matches_count/build.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/q06_get_unique_matches_count/build.py b/q06_get_unique_matches_count/build.py index 014497e..3e0bb9c 100644 --- a/q06_get_unique_matches_count/build.py +++ b/q06_get_unique_matches_count/build.py @@ -1,5 +1,17 @@ +# %load q06_get_unique_matches_count/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 + +def get_unique_matches_count(): + + arr = read_ipl_data_csv(path, '|S100') + arr = arr[:,0:1] + return np.unique(arr).size + +get_unique_matches_count() + + From a0164083dc2014cbe1461d9ea1f91d2fc2f11381 Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Sun, 30 Sep 2018 07:34:08 +0000 Subject: [PATCH 8/9] Done --- q07_get_unique_teams_set/build.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/q07_get_unique_teams_set/build.py b/q07_get_unique_teams_set/build.py index 17fefd2..60f9451 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 +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(): + + ipl_df = read_ipl_data_csv(path,dtype = 'S50') + ipl_new = ipl_df[:,[3,4]] + ipl_unique = set(np.unique(ipl_new)) + return ipl_unique + +# ipl_df + + From 058cedd88d07e6c53b393a70f619245ad9ea32e0 Mon Sep 17 00:00:00 2001 From: akshaylakade Date: Sun, 30 Sep 2018 08:23:21 +0000 Subject: [PATCH 9/9] 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..f436b0d 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(): + ipl_df = read_ipl_data_csv(path,dtype = 'S50') + ipl_new = ipl_df[:,17].astype(int) + ipl_sum = np.sum(ipl_new) + return ipl_sum + + +