The blank grey row that you’ve pointed out is there to make room for the name of the DataFrame’s index, which is variety
. That index came from the default behaviour of df.groupby()
: the grouped-by column(s) end up in the index of the resulting DataFrame.
To override this, try df.groupby('variety', as_index=False)
. Or, if you have a DataFrame with an index that you want to move into a column, run df.reset_index()
.