forked from s452662/SystemyRozmyte
Add seasonMatches method
This commit is contained in:
parent
711ecbe1f7
commit
b52ce30136
@ -29,7 +29,17 @@ def last5Matches(season, teamA, data, df):
|
|||||||
return last_before_date
|
return last_before_date
|
||||||
|
|
||||||
|
|
||||||
|
def seasonMatches(season, teamA, data, df):
|
||||||
|
# Wybierz rekordy dla danej pary drużyn i sezonu
|
||||||
|
subset = df[((df['season'] == season) & ((df['home_team'] == teamA) | (df['away_team'] == teamA)))]
|
||||||
|
|
||||||
|
# Filtruj dane, aby zawierały te przed daną datą
|
||||||
|
before_given_date = subset[pd.to_datetime(subset['date']) < pd.to_datetime(data)]
|
||||||
|
|
||||||
|
# Posortuj wg daty w odwrotnej kolejności
|
||||||
|
before_given_date = before_given_date.sort_values(by='date', ascending=False)
|
||||||
|
|
||||||
|
return before_given_date
|
||||||
|
|
||||||
def getResult(score,teamHome):
|
def getResult(score,teamHome):
|
||||||
x,y = score.split('-')
|
x,y = score.split('-')
|
||||||
|
Loading…
Reference in New Issue
Block a user