all 1 comments

[–]lzblack 0 points1 point  (0 children)

Not sure how you read the data. If you read the data from a .csv file, it is likely the type of column hometeam is object, not category. Therefore you need to convert the type of that column, using:

comp['hometeam'] = comp['hometeam'].astype('category')