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
4 changes: 3 additions & 1 deletion q01_read_csv_data_to_df/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
path = "data/ipl_dataset.csv"

# Solution

def read_csv_data_to_df(path):
df = pd.read_csv(path)
return df
3 changes: 3 additions & 0 deletions q02_get_unique_values/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
ipl_df = read_csv_data_to_df("data/ipl_dataset.csv")

#Solution
def get_unique_venues():
venues = ipl_df['venue'].unique()
return venues
4 changes: 3 additions & 1 deletion q03_get_run_counts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@
ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv")

# Solution

def get_run_counts():
counts = ipl_df['runs'].value_counts()
return counts
3 changes: 2 additions & 1 deletion q04_get_match_specific_df/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv")

# Solution

def get_match_specific_df(match_code):
return ipl_df[ipl_df['match_code'] == match_code]
2 changes: 2 additions & 0 deletions q05_create_bowler_filter/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv")

# Solution
def create_bowler_filter(bowler):
return ipl_df['bowler'] == bowler
6 changes: 2 additions & 4 deletions q06_get_match_innings_runs/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@
ipl_df = read_csv_data_to_df("data/ipl_dataset.csv")

# Solution




def get_match_innings_runs():
return ipl_df.groupby(['match_code','inning'])['runs'].sum()
2 changes: 2 additions & 0 deletions q07_get_run_counts_by_match/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
ipl_df = read_csv_data_to_df("./data/ipl_dataset.csv")

# Solution
def get_runs_counts_by_match():
return ipl_df.pivot_table(index='match_code',columns='runs',aggfunc='count')['batsman']