Skip to content

Commit Live PR #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
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
4 changes: 4 additions & 0 deletions q02_zeros_reshaped/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
from greyatomlib.python_intermediate.q01_zeros_array.build import array_zeros

# Write your code
def array_reshaped_zeros():
zeros_array = array_zeros()
zeros_array_reshaped = np.reshape(zeros_array.ravel(),(2,3,4))
return zeros_array_reshaped
7 changes: 6 additions & 1 deletion q03_create_3d_array/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Default Imports
import numpy as np

# Enter solution here
# Enter solution here
def create_3d_array():
N=3*3*3
A =np.arange(N)
three_d_array=A.reshape(3,3,3)
return three_d_array
7 changes: 6 additions & 1 deletion q04_read_csv_data_to_ndarray/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Default Imports
import numpy as np
path = "./data/ipl_matches_small.csv"
input_dtype = '|S100'

# Enter code here
def read_csv_data_to_ndarray(path,dtype):
csv = np.genfromtxt(path,delimiter=",",skip_header=1,dtype=dtype)
return csv

# Enter code here
5 changes: 4 additions & 1 deletion q05_read_csv_data/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Default imports
import numpy as np

# Enter code here
# Enter code here
def read_ipl_data_csv(path, dtype='|S50'):
ipl_matches_array = np.genfromtxt(path,delimiter=",",skip_header=1,dtype=dtype)
return ipl_matches_array
7 changes: 6 additions & 1 deletion 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
import numpy as np
path = 'data/ipl_matches_small.csv'

# Enter Code Here
def get_unique_matches_count():
data=read_ipl_data_csv(path,'|S50')
uu = np.unique(data[:,0])
ipl_matches_array = np.unique(data[:,0]).size
return ipl_matches_array
6 changes: 6 additions & 0 deletions q07_get_unique_teams_set/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# 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"

# Enter Code Here
def get_unique_teams_set():
data=read_ipl_data_csv(path,'|S50')
n1 = np.unique(data[:,3])
n2 = np.unique(data[:,4])
return set(np.union1d(n1,n2))
5 changes: 4 additions & 1 deletion q08_get_total_extras/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@

path = 'data/ipl_matches_small.csv'

# Enter Code Here
# Enter Code Here
def get_total_extras():
data = read_ipl_data_csv(path,'|S50')
return data[:,-6].astype(np.int).sum()