This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #load data sets | |
| train_df = pd.read_csv("../input/covid19-global-forecasting-week-4/train.csv") | |
| test_df = pd.read_csv("../input/covid19-global-forecasting-week-4/test.csv") | |
| submission = pd.read_csv("../input/covid19-global-forecasting-week-4/submission.csv") | |
| #check for missings | |
| display(train_df.isnull().sum()/len(train_df)*100) | |
| display(test_df.isnull().sum()/len(test_df)*100) | |
| #Id 0.000000 | |
| #Province_State 57.507987 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| counter = [animal for animal in animal_park if animal != 'Dog' and animal != 'Cat'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| counter = [] | |
| for animal in animal_park: | |
| if animal != 'Dog' and animal != 'Cat': | |
| counter.append(animal) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| counter = [animal for animal in animal_park] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| counter = [] | |
| for animal in animal_park: | |
| counter.append(animal) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def soc_iter(TEAM,home,away,ftr): | |
| df['Draws'] = 'No_Game' | |
| df.loc[((home == TEAM) & (ftr == 'D')) | ((away == TEAM) & (ftr == 'D')), 'Draws'] = 'Draw' | |
| df.loc[((home == TEAM) & (ftr != 'D')) | ((away == TEAM) & (ftr != 'D')), 'Draws'] = 'No_Draw' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def soc_loop(leaguedf,TEAM,): | |
| leaguedf['Draws'] = 99999 | |
| for row in range(0, len(leaguedf)): | |
| if ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')) | \ | |
| ((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')): | |
| leaguedf['Draws'].iloc[row] = 'Draw' | |
| elif ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')) | \ | |
| ((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')): | |
| leaguedf['Draws'].iloc[row] = 'No_Draw' | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def soc_loop(leaguedf,TEAM,): | |
| leaguedf['Draws'] = 99999 | |
| for row in range(0, len(leaguedf)): | |
| if ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')) | \ | |
| ((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')): | |
| leaguedf['Draws'].iloc[row] = 'Draw' | |
| elif ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')) | \ | |
| ((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def soc_loop(leaguedf,TEAM,): | |
| leaguedf['Draws'] = 99999 | |
| for row in range(0, len(leaguedf)): | |
| if ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')) | \ | |
| ((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] == 'D')): | |
| leaguedf['Draws'].iloc[row] = 'Draw' | |
| elif ((leaguedf['HomeTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')) | \ | |
| ((leaguedf['AwayTeam'].iloc[row] == TEAM) & (leaguedf['FTR'].iloc[row] != 'D')): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def soc_iter(TEAM,home,away,ftr): | |
| #team, row['HomeTeam'], row['AwayTeam'], row['FTR'] | |
| if [((home == TEAM) & (ftr == 'D')) | ((away == TEAM) & (ftr == 'D'))]: | |
| result = 'Draw' | |
| elif [((home == TEAM) & (ftr != 'D')) | ((away == TEAM) & (ftr != 'D'))]: | |
| result = 'No_Draw' | |
| else: | |
| result = 'No_Game' | |
| return result |
NewerOlder