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
5 changes: 3 additions & 2 deletions q01_zeros_array/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
import numpy as np

# Your solution


def array_zeros():
zeros_array=np.zeros((3,4,2))
return zeros_array
2 changes: 2 additions & 0 deletions q02_zeros_reshaped/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
from greyatomlib.python_intermediate.q01_zeros_array.build import array_zeros

# Write your code
def array_reshaped_zeros():
return np.reshape(array_zeros(),(2,3,4))
6 changes: 5 additions & 1 deletion 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
# Enter solution here
def create_3d_array():
N=27
new=np.arange(0,N)
return np.reshape(new,(3,3,3))
6 changes: 5 additions & 1 deletion q04_read_csv_data_to_ndarray/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
import numpy as np
path = "./data/ipl_matches_small.csv"

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

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

import numpy as np
# Enter Code Here
dtype='|S20'
def get_unique_matches_count():
data=np.genfromtxt("data/ipl_matches_small.csv", skip_header=1,delimiter=",", dtype=np.int64);
match_code = data[:,0]
bincount = np.bincount(match_code)
ipl_matches_array = np.count_nonzero(bincount)
return ipl_matches_array
9 changes: 8 additions & 1 deletion q07_get_unique_teams_set/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Default imports
from greyatomlib.python_intermediate.q05_read_csv_data.build import read_ipl_data_csv
path = "data/ipl_matches_small.csv"

import numpy as np
# Enter Code Here
dtype='|S50'
def get_unique_teams_set():
data=read_ipl_data_csv(path,dtype)
team1= data[:,3].astype(np.str)
team2= data[:,4].astype(np.str)
variable=np.union1d(team1,team2)
return np.all(variable)
9 changes: 7 additions & 2 deletions q08_get_total_extras/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
import numpy as np

path = 'data/ipl_matches_small.csv'

# Enter Code Here
dtype='|S20'
# Enter Code Here
def get_total_extras():
data=np.genfromtxt(path, skip_header=1,delimiter=",",dtype=dtype);
x=data[:,17].astype(np.int)
extrun = np.sum(x)
return extrun