text_html_output_1.png
import matplotlib.pyplot as plt

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

players = pd.read_csv('/kaggle/input/fifa-world-cup/WorldCupPlayers.csv')
matches = pd.read_csv('/kaggle/input/fifa-world-cup/WorldCupMatches.csv')
cups = pd.read_csv('/kaggle/input/fifa-world-cup/WorldCups.csv')

matches = matches.dropna()

partidos_por_anio = matches[['Year', 'MatchID']].dropna().astype('Int64')

jugadores_goles = players[['MatchID', 'Player Name', 'goles']]

goles = pd.merge(jugadores_goles, partidos_por_anio, on='MatchID', how='inner')
goles

inicio = goles.groupby('Player Name').agg({'Year': 'min'})
inicio = inicio.to_dict()['Year']

plt.hist(goles['antiguedad'])