From 7166f9e2b6ad4d1b81648f2ff680d1662dc342fc Mon Sep 17 00:00:00 2001 From: iampa1 Date: Mon, 10 Sep 2018 08:08:44 +0000 Subject: [PATCH 1/8] Done --- q01_zeros_array/build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/q01_zeros_array/build.py b/q01_zeros_array/build.py index 5501f7a..9c02f69 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 +def array_zeros(): + zeros_array=np.zeros([3,4,2]) + return zeros_array + +array_zeros() + -# Your solution From cb29b6dfe1ab806e398dbbb3fe87bccc9d294e63 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Mon, 10 Sep 2018 08:17:39 +0000 Subject: [PATCH 2/8] Done --- q02_zeros_reshaped/build.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/q02_zeros_reshaped/build.py b/q02_zeros_reshaped/build.py index ed629c7..511888d 100644 --- a/q02_zeros_reshaped/build.py +++ b/q02_zeros_reshaped/build.py @@ -1,5 +1,14 @@ +# %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_reshaped=array_zeros().reshape(2,3,4) + return zeros_array_reshaped +array_zeros().reshape(2,3,4) +array_reshaped_zeros() + + From 4917a89905980218d3cd93aa4044d7b565149546 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Wed, 19 Sep 2018 08:44:31 +0000 Subject: [PATCH 3/8] Done --- q03_create_3d_array/build.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7bb6e2f..b0bdf57 100644 --- a/q03_create_3d_array/build.py +++ b/q03_create_3d_array/build.py @@ -1,4 +1,10 @@ +# %load q03_create_3d_array/build.py # Default Imports import numpy as np +def create_3d_array(): + return np.arange(0,27).reshape(3,3,3) + +# Enter solution here +np.arange(0,27).reshape(3,3,3) + -# Enter solution here \ No newline at end of file From b1a52801081d16ce7201704952d951c2ae7dd9ed Mon Sep 17 00:00:00 2001 From: iampa1 Date: Sun, 30 Sep 2018 15:08:41 +0000 Subject: [PATCH 4/8] 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..24e4d3f 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' + +def read_csv_data_to_ndarray(path,dtype): + return np.genfromtxt(path,delimiter=',',dtype=dtype,skip_header=1) + + + +# Enter code here +read_csv_data_to_ndarray('./data/ipl_matches_small.csv',int) + -# Enter code here \ No newline at end of file From 1af43bafe6bf9bdd380b7ab1bc662f9db09eb413 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Sun, 30 Sep 2018 15:15:13 +0000 Subject: [PATCH 5/8] Done --- q05_read_csv_data/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/q05_read_csv_data/build.py b/q05_read_csv_data/build.py index 5c70e6e..b1ad85c 100644 --- a/q05_read_csv_data/build.py +++ b/q05_read_csv_data/build.py @@ -1,4 +1,12 @@ +# %load q05_read_csv_data/build.py # Default imports import numpy as np -# Enter code here \ No newline at end of file +def read_ipl_data_csv(path,dtype): + ipl_matches_array = np.genfromtxt(path,dtype=dtype,delimiter=',',skip_header=1) + return ipl_matches_array + +# Enter code here + + + From 756df37d9a251c99412a7e377477f71a938d4a30 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Sun, 30 Sep 2018 15:44:00 +0000 Subject: [PATCH 6/8] Done --- q06_get_unique_matches_count/build.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/q06_get_unique_matches_count/build.py b/q06_get_unique_matches_count/build.py index 014497e..90cafd2 100644 --- a/q06_get_unique_matches_count/build.py +++ b/q06_get_unique_matches_count/build.py @@ -1,5 +1,25 @@ +# %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' - +path = './data/ipl_matches_small.csv' +import numpy as np # Enter Code Here + +def get_unique_matches_count(path=path,dtype=int): + x=np.genfromtxt(path,dtype=dtype,delimiter=',',skip_header=1) + #ipl_matches_array = [] + ipl_matches_array = len( np.unique(x[:,0])) + return ipl_matches_array + + + + + + +get_unique_matches_count('./data/ipl_matches_small.csv',int) + + + + + + From d030f8b76378b001f609ca54c1decd97a139dc31 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Mon, 1 Oct 2018 04:50:48 +0000 Subject: [PATCH 7/8] Done --- q07_get_unique_teams_set/build.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/q07_get_unique_teams_set/build.py b/q07_get_unique_teams_set/build.py index 17fefd2..cd0c147 100644 --- a/q07_get_unique_teams_set/build.py +++ b/q07_get_unique_teams_set/build.py @@ -1,5 +1,28 @@ +# %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(path=path,dtype=str): + x=np.genfromtxt(path,delimiter=',',skip_header=1,dtype=None,usecols=3) + y=np.genfromtxt(path,delimiter=',',skip_header=1,dtype=None,usecols=4) + + a=np.unique(x) + b=np.unique(y) + v=np.union1d(b,a) + return set(v) + + + + + + + + + + + + + + From c98b5d64cb63ea8663fb369fb70b02ae2c59a2e9 Mon Sep 17 00:00:00 2001 From: iampa1 Date: Mon, 1 Oct 2018 05:49:27 +0000 Subject: [PATCH 8/8] Done --- q08_get_total_extras/build.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/q08_get_total_extras/build.py b/q08_get_total_extras/build.py index 95890c1..e0e4720 100644 --- a/q08_get_total_extras/build.py +++ b/q08_get_total_extras/build.py @@ -1,7 +1,17 @@ +# %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' +def get_total_extras(path=path,dtype=None): + x= np.genfromtxt(path,dtype=dtype,delimiter=',',skip_header=1,usecols=17) + + return sum(x) + + +# Enter Code Here +get_total_extras() + + -# Enter Code Here \ No newline at end of file