benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf ae11e5a1-9250-5046-a3b5-ad409d2e8a7f

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

# Constants
CATEGORIES = ['A', 'B', 'C', 'D', 'E']

def task_func(value_range=(0, 100)):
    """
    Generate a category distribution within a specified range and return as a DataFrame.

    Parameters:
    value_range (tuple): A tuple specifying the range (min, max) for generating random values for categories.
    
    Returns:
    DataFrame: A pandas DataFrame that has two columns: 'Category' (category names) and 'Count' (count of each category). 

    Requirements:
    - pandas
    - random

    Example:
    >>> random.seed(0)
    >>> df = task_func()
    >>> df['Count'][0] >= 0
    True
    """

instruct prompt

Generate a category distribution within a specified range and return as a DataFrame.
The function should output with:
    DataFrame: A pandas DataFrame that has two columns: 'Category' (category names) and 'Count' (count of each category).
You should write self-contained code starting with:

Code

import pandas as pd
import random
# Constants
CATEGORIES = ['A', 'B', 'C', 'D', 'E']
def task_func(value_range=(0, 100)):

code prompt

Code

import pandas as pd
import random
# Constants
CATEGORIES = ['A', 'B', 'C', 'D', 'E']
def task_func(value_range=(0, 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