benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 78b8ef04-2add-5462-bec9-f43360e7ef3f

Problem

Answer published by the source. Consult the official source to check your work against its answer.

complete prompt

import pandas as pd
import random


def task_func(product_list, categories):
    """
    Create a sales report for a list of products in different categories.
    The report includes the quantity sold and revenue generated for each product.
    
    Parameters:
    product_list (list): The list of products.
    categories (list): A list of categories for the products.
    
    Returns:
    DataFrame: A pandas DataFrame with sales data for the products.
    
    Note:
    - The column names uses are 'Product', 'Category', 'Quantity Sold', and 'Revenue'.
    - The quantity sold is random number from 1 to 100
    - The revenue is the number of quantity sold times with the random number from 10 to 100

    Requirements:
    - pandas
    - random
    
    Example:
    >>> random.seed(0)
    >>> report = task_func(['Product 1'], ['Electronics', 'Fashion', 'Home', 'Beauty', 'Sports'])
    >>> report.iloc[0]['Category'] in ['Electronics', 'Fashion', 'Home', 'Beauty', 'Sports']
    True
    """

instruct prompt

Create a sales report for a list of products in different categories. The report includes the quantity sold and revenue generated for each product.
Note that: The column names uses are 'Product', 'Category', 'Quantity Sold', and 'Revenue'. The quantity sold is random number from 1 to 100 The revenue is the number of quantity sold times with the random number from 10 to 100
The function should output with:
    DataFrame: A pandas DataFrame with sales data for the products.
You should write self-contained code starting with:

Code

import pandas as pd
import random
def task_func(product_list, categories):

code prompt

Code

import pandas as pd
import random
def task_func(product_list, categories):

entry point

task_func

libs

  • pandas
  • random

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import