diff --git a/q01_zeros_array/build.py b/q01_zeros_array/build.py index 5501f7a..4ae1cc8 100644 --- a/q01_zeros_array/build.py +++ b/q01_zeros_array/build.py @@ -1,8 +1,15 @@ +# %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 + + + + diff --git a/q02_zeros_reshaped/build.py b/q02_zeros_reshaped/build.py index ed629c7..bc8348c 100644 --- a/q02_zeros_reshaped/build.py +++ b/q02_zeros_reshaped/build.py @@ -1,5 +1,11 @@ +# %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 +zeros_array = np.zeros((3,4,2)) +def array_reshaped_zeros(): + zeros_array_reshaped = zeros_array.reshape(2,3,4) + return zeros_array_reshaped + + diff --git a/q03_create_3d_array/build.py b/q03_create_3d_array/build.py index 7bb6e2f..94cdd8a 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(): + arr = np.arange(27).reshape(3,3,3) + N = np.size(arr) + return arr + + diff --git a/q04_read_csv_data_to_ndarray/build.py b/q04_read_csv_data_to_ndarray/build.py index fb71e6e..aff4778 100644 --- a/q04_read_csv_data_to_ndarray/build.py +++ b/q04_read_csv_data_to_ndarray/build.py @@ -1,5 +1,12 @@ +# %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): + return (np.genfromtxt(path, delimiter=',', dtype=dtype,skip_header=1)) + + + -# Enter code here \ No newline at end of file diff --git a/q05_read_csv_data/build.py b/q05_read_csv_data/build.py index 5c70e6e..60b2c39 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 -# Enter code here \ No newline at end of file + +# Enter code here +def read_ipl_data_csv(path,dtype): + ipl_matches_array = np.genfromtxt(path,delimiter=',',dtype=dtype,skip_header=1) + print(type(ipl_matches_array)) + return (ipl_matches_array) +read_ipl_data_csv('data/ipl_matches_small.csv', dtype='|S50') + +