It sounds like you want to build a feature related to — likely a model or data pipeline to predict or identify the winner of American horse races (Carreras Americanas).
# Fill NaNs race_history_df = race_history_df.fillna(0) winner carreras americanas
# Days since last race race_history_df['days_since_last'] = ( race_history_df.groupby('horse_id')['race_date'].diff().dt.days ) It sounds like you want to build a