Skip to content
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

Commit Live PR #208

Open
wants to merge 6 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
13 changes: 12 additions & 1 deletion q01_get_total_deliveries_players/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
# %load q01_get_total_deliveries_players/build.py
# Default imports
import numpy as np

ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",")
ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',')

# Your Solution
def get_total_deliveries_played(batsman):
batcount = 0
#ptn=ipl_matches_array[:,13].astype(np.unicode_)
ptn=ipl_matches_array[:,13]
batcount = int(np.sum(ptn == batsman))
return batcount

get_total_deliveries_played(b'SR Tendulkar')



12 changes: 11 additions & 1 deletion q02_get_wicket_delivery_numbers_array/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# %load q02_get_wicket_delivery_numbers_array/build.py
#Default Imports
import numpy as np

ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",")
ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',')

#Your Solution
def get_wicket_delivery_numbers_array(player):
#over = ipl_matches_array[:,11].astype(np.unicode_)
over = ipl_matches_array[:,11]
#btsmn = ipl_matches_array[:,20].astype(np.unicode_)
btsmn = ipl_matches_array[:,20]
return over[(btsmn == player)]

get_wicket_delivery_numbers_array(b'ST Jayasuriya')


10 changes: 8 additions & 2 deletions q03_get_toss_win_count/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# %load q03_get_toss_win_count/build.py
#Default Imports
import numpy as np
ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",")

ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',')

#Your Solution
def get_toss_win_count(team):
indx=ipl_matches_array[:,0]
mtch=ipl_matches_array[:,5]
return int(np.count_nonzero(np.unique(indx[(mtch==team)])))
get_toss_win_count(b'Mumbai Indians')


8 changes: 7 additions & 1 deletion q04_get_all_sixes_filter/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# %load q04_get_all_sixes_filter/build.py
#Default Imports
import numpy as np
ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",")
ipl_matches_array=np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',')


#Your Solution
def get_all_sixes_filter():
return (ipl_matches_array[:,16].astype(int) == 6)

get_all_sixes_filter()


13 changes: 10 additions & 3 deletions q05_create_delivery_series/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# %load q05_create_delivery_series/build.py
#Default Imports
import pandas as pd
import numpy as np
ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",")

import pandas as pd
ipl_matches_array=np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',')

#Your Solution
def create_delivery_series():
return pd.Series(ipl_matches_array[:,11])


create_delivery_series()


9 changes: 8 additions & 1 deletion q06_create_runs_series/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# %load q06_create_runs_series/build.py
#Default Imports
import pandas as pd
import numpy as np
ipl_matches_array =np.genfromtxt("data/ipl_matches_small.csv", dtype="|S50", skip_header=1, delimiter=",")
ipl_matches_array =np.genfromtxt('data/ipl_matches_small.csv', dtype='|S50', skip_header=1, delimiter=',')

#Your Solution
def create_runs_series(match_code):
blt = ipl_matches_array[(ipl_matches_array[:,0] == match_code)]
return pd.Series(blt[:,11],index=blt[:,16])

create_runs_series(b'392203')