I want to aggregate some data to append to a dataframe. The following gives me the number of wins per name import pandas as pd
data = [[1,'tom', 10], [1,'nick', 15], [2,'juli', 14], [2,'peter', 20], [3,'juli', 3], [3,'peter', 13]]
have = pd.DataFrame(data, columns = ['Round', 'Winner', 'Score'])
WinCount= have.groupby(['Winner']).size().to_frame('WinCount')
WinCount
, but the output does not give me two columns, named Winner and WinCount. In stead, the first column has no name, and the column name then appears on the second line:
How can I get a dataframe without these two "blank" fields