benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf eedd3793-eb58-5c11-8f81-60455a755a13

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, min_value = 10, max_value = 100):
    """
    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.
    min_value (int): The minimum value for quantity sold and revenue.
    max_value (int): The maximum value for quantity sold and revenue.
    
    Returns:
    DataFrame: A pandas DataFrame with sales data for the products.
    
    Note:
    - The column names uses are 'Product', 'Category', 'Quantity Sold', and 'Revenue'.

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

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 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, min_value = 10, max_value = 100):

code prompt

Code

import pandas as pd
import random
def task_func(product_list, categories, min_value = 10, max_value = 100):

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