There is a Pandas dataframe: id title rating decade 4728 Bad Education (2019) 0.5 2010-2020 35638 35638 Palooka (1934) 0.5 1934 1930-1940 21445 21445 High Moon (2019) 0.5 2019 2010-2020 40291 40291 Saint Maud (2019) 0.5 2019 2010-2020 29462 29462 Mad at the Moon (1992) 0.5 1992 1990-2000 46978 46978 The Butterfly Ball (1977) 0.5 1977 1970-1980 42931 42931 Snowboarďáci (2004) 0.5 2004 2000-2010 38670 38670 Recon 2020: The Caprini Massacre (2004) 0.5 2004 2000-2010 25506 25506 Karagoez catalogo 9,5 (1983) 0.5 1983 1980-1990 43989 43989 Starting a Skyscraper (1902) 0.5 1902 1900-1910 Write a function that shows which decade had the most movies with a high rating Write a function that creates a "Decade of Release" column and assigns a decade to each movie based on the values in the "Year" column Example: 1889 Result: 1880-1890 Example 2: 1954 Result 2: 1950-1960 Example 3: 2011 Result 3: 2010-2020 Example 4: raovyavas Result: NaN
def decade(year): if year >= 1900 and year <= 1910: return "1900-1910" elif year > 1910 and year <= 1920: return "1910-1920" elif year > 1920 and year <= 1930: return "1920-1930" elif year > 1930 and year <= 1940: return "1930-1940" elif year > 1940 and year <= 1950: return "1940-1950" elif year > 1950 and year <= 1960: return "1950-1960" elif year > 1960 and year <= 1970: return "1960-1970" elif year > 1970 and year <= 1980: return "1970-1980" elif year > 1980 and year <= 1990: return "1980-1990" elif year > 1990 and year <= 2000: return "1990-2000" elif year > 2000 and year <= 2010: return "2000-2010" elif year > 2010 and year <= 2020: return "2010-2020