Generation

generate functionThu, 12 Jan 2023

There is a table: userId movieId rating timestamp title genres 0 1 296 5.0 1147880044 Pulp Fiction (1994) Comedy|Crime|Drama|Thriller 1 1 306 3.5 1147868817 Three Colors: Red (Trois couleurs: Rouge) (1994) Drama 2 1 307 5.0 1147868828 Three Colors: Blue (Trois couleurs: Bleu) (1993) Drama 3 1 665 5.0 1147878820 Underground (1995) Comedy|Drama|War 4 1 899 3.5 1147868510 Singin' in the Rain (1952) Comedy|Musical|Romance Write code for Pandas that shows the movie with the most rows with a value of 5.0 in the rating column

def most_5(data): data.groupby('movieId')['rating'].count() return data.sort_values(by = 'rating', ascending = False).head(1) most_5(df)

Questions about programming?Chat with your personal AI assistant