Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions q01_zeros_array/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
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
5 changes: 3 additions & 2 deletions q02_zeros_reshaped/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# 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
8 changes: 6 additions & 2 deletions q03_create_3d_array/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Default Imports
import numpy as np

# Enter solution here
def create_3d_array():
value=np.zeros((3,3,3))
elements=value.size
total_values=np.arange(elements)
reshape_array=total_values.reshape(3,3,3)
return reshape_array
5 changes: 3 additions & 2 deletions q04_read_csv_data_to_ndarray/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Default Imports
import numpy as np
path = "./data/ipl_matches_small.csv"

# Enter code here
def read_csv_data_to_ndarray(path,dtype):
numpy_array=np.genfromtxt(path,dtype=dtype,delimiter=',',skip_header=1)
return numpy_array
5 changes: 3 additions & 2 deletions q05_read_csv_data/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Default imports
import numpy as np

# Enter code here
def read_ipl_data_csv(path, dtype='|S50'):
numpy_array = np.genfromtxt(path,delimiter=',',dtype='|S50',skip_header=1)
return numpy_array
9 changes: 7 additions & 2 deletions q06_get_unique_matches_count/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Default imports
from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv
path = 'data/ipl_matches_small.csv'

# Enter Code Here
import numpy as np
def get_unique_matches_count():
def read_ipl_data_csv(file_path, dtype='|S50'):
numpy_array = np.genfromtxt(file_path,delimiter=',',dtype='|S50',skip_header=1)
return numpy_array
unique_matches_count= len(np.unique(read_ipl_data_csv(path)[0:,0]))
return unique_matches_count