I have a huge dataset, which contains a 'Player' column. I want to create a function whereby I pass a value in as a parameter, and the function creates a dataframe slice which only contains rows which have a 'Player' value of whatever I have passed into the function. I want to be able to use this dataframe slice to then build some plots.
I really am a python novice so am unsure where to start. This is my first stab, any help would be much appreciated!
historics = pd.read_csv('historicdivs.csv')
def playerslice(name):
is_player = historics['Player'] == 'name(as in the
parameter)'
name(as in the parameter)_divs = historics[is_player]
return name_divs
Let me know if I haven't been clear, I'm new to the site.
Cheers.