Generation

generate functionSat, 18 Feb 2023

regions = ['North America', 'Europe', 'Japan', 'Other'] na_sales = df['NA_Sales'].sum() eu_sales = df['EU_Sales'].sum() jp_sales = df['JP_Sales'].sum() oth_sales = df['Other_Sales'].sum() Write a function that create a Pandas dataframe with this data. Example output: North America 1111 Europe 1234 Japan 3456 Other 5678

def sales_df(regions, na_sales, eu_sales, jp_sales, oth_sales): return df sales_df(regions, na_sales, eu_sales, jp_sales, oth_sales)

Questions about programming?Chat with your personal AI assistant