From 869aac2dce4cd38cdb41a861654004ad67db896e Mon Sep 17 00:00:00 2001 From: aditya207 Date: Fri, 20 Apr 2018 09:05:41 +0000 Subject: [PATCH 1/7] Done --- q01_zeros_array/build.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/q01_zeros_array/build.py b/q01_zeros_array/build.py index 5501f7a..f94ee0c 100644 --- a/q01_zeros_array/build.py +++ b/q01_zeros_array/build.py @@ -1,8 +1,12 @@ +# %load q01_zeros_array/build.py # Default Imports -import sys, os -sys.path.append(os.path.join(os.path.dirname(os.curdir), '..' )) +# Your solution import numpy as np +def array_zeros(): + zeros_array = np.zeros((3,4,2),dtype=float) + print(zeros_array) -# Your solution + return zeros_array +array_zeros() From 776d38519393aeb75e69ccf3c3c917b7d3c81d7e Mon Sep 17 00:00:00 2001 From: aditya207 Date: Fri, 20 Apr 2018 09:09:59 +0000 Subject: [PATCH 2/7] 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..873d9ee 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 = np.zeros((2,3,4),dtype=float) + print(zeros_array) + + return zeros_array +array_reshaped_zeros() + + From bc93e8e7215e39ef56e9463fca6148d5143c0def Mon Sep 17 00:00:00 2001 From: aditya207 Date: Fri, 20 Apr 2018 10:27:09 +0000 Subject: [PATCH 3/7] Done --- q03_create_3d_array/build.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7bb6e2f..d955faf 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 = 3*3*3 + a = np.arange(0, N) + zeros_array = np.reshape(a,(3,3,3)) + print(zeros_array) + + return zeros_array +create_3d_array() + + + From 4cef51cd5121aa3f2297eeee4d757c73fdec8520 Mon Sep 17 00:00:00 2001 From: aditya207 Date: Thu, 24 May 2018 18:08:58 +0000 Subject: [PATCH 4/7] 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..84b8dfa 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,dtype=np.float64): + path1 = np.genfromtxt(path,dtype=dtype, skip_header = 1,delimiter=',') + return path1 +read_csv_data_to_ndarray(path,dtype='|S20') + + + -# Enter code here \ No newline at end of file From fbc3c890ccabffaf2476d7ca63c00b24cd6719a4 Mon Sep 17 00:00:00 2001 From: aditya207 Date: Thu, 24 May 2018 18:24:12 +0000 Subject: [PATCH 5/7] Done --- q05_read_csv_data/build.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/q05_read_csv_data/build.py b/q05_read_csv_data/build.py index 5c70e6e..2a8e0d2 100644 --- a/q05_read_csv_data/build.py +++ b/q05_read_csv_data/build.py @@ -1,4 +1,13 @@ +# %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): + path1 = np.genfromtxt(path,dtype=dtype,skip_header = 1,delimiter=',') + print(path1.shape) + return path1 +read_ipl_data_csv(path,dtype='|S50') + -# Enter code here \ No newline at end of file From be12420e4d5505b76f4cfe4ae5a2635e80e7852a Mon Sep 17 00:00:00 2001 From: aditya207 Date: Sat, 26 May 2018 15:41:17 +0000 Subject: [PATCH 6/7] Done --- q06_get_unique_matches_count/build.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/q06_get_unique_matches_count/build.py b/q06_get_unique_matches_count/build.py index 014497e..e15f3ff 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 +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 = np.genfromtxt(path,dtype='|S20', skip_header = 1,delimiter=',') + matches = len(np.unique(ipl_matches_array [:,0])) + return matches +get_unique_matches_count() + + + From dcda0cb3aeca21abc77eab1bdecfdb11c3ca3a21 Mon Sep 17 00:00:00 2001 From: aditya207 Date: Sun, 27 May 2018 13:42:54 +0000 Subject: [PATCH 7/7] 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..ccb62de 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_matches_array = np.genfromtxt(path,dtype='|S50', skip_header = 1,delimiter=',') + team1 = np.unique(ipl_matches_array [:,3]) + team2 = np.unique(ipl_matches_array [:,4]) + teams = np.union1d(team1,team2) + teamsset = set(teams) + return teamsset +get_unique_teams_set() + +