Skip to content

Commit Live PR #243

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions q01_zeros_array/build.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# %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
def array_zeros():
zeros_array = np.zeros([3,4,2])
return zeros_array

# Your solution




9 changes: 8 additions & 1 deletion q02_zeros_reshaped/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# %load q02_zeros_reshaped/build.py
# Default imports
import numpy as np
from greyatomlib.python_intermediate.q01_zeros_array.build import array_zeros

def array_reshaped_zeros():
var=array_zeros().reshape((2,3,4))
return var
# Write your code




10 changes: 9 additions & 1 deletion q03_create_3d_array/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# %load q03_create_3d_array/build.py
# Default Imports
import numpy as np
def create_3d_array():
N = np.zeros((3, 3, 3)).size
numbers = np.arange(0,N)
return np.reshape(numbers,(3,3,3))
# Enter solution here




# Enter solution here
13 changes: 11 additions & 2 deletions q04_read_csv_data_to_ndarray/build.py
Original file line number Diff line number Diff line change
@@ -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"

# Enter code here
path = './data/ipl_matches_small.csv'
def read_csv_data_to_ndarray(path=path, input_dtype = np.float64):
from numpy import genfromtxt
return np.genfromtxt(path, delimiter=',', dtype = input_dtype, skip_header=1)
# Enter code here





10 changes: 9 additions & 1 deletion q05_read_csv_data/build.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# %load q05_read_csv_data/build.py
# Default imports
import numpy as np
path = './data/ipl_matches_small.csv'
def read_ipl_data_csv(path, dtype='|S50'):
ipl_matches_array = np.genfromtxt(path, delimiter= ',', dtype=dtype, skip_header=1)
return ipl_matches_array

read_ipl_data_csv(path)
# Enter code here


# Enter code here
11 changes: 11 additions & 0 deletions q06_get_unique_matches_count/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# %load q06_get_unique_matches_count/build.py
# 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
def get_unique_matches_count(path=path):
data = np.genfromtxt(path, delimiter= ',', skip_header=1)
ipl_matches_array = len(set(data[:,0]))
return ipl_matches_array

get_unique_matches_count(path)

# Enter Code Here



13 changes: 12 additions & 1 deletion q07_get_unique_teams_set/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# %load q07_get_unique_teams_set/build.py
# Default imports
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():
data= read_ipl_data_csv(path,dtype='|S50')
team1 = set(data[:,3])
team2 = set(data[:,4])
teamUnion = set().union(team1,team2)
return teamUnion
get_unique_teams_set()