benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e1b903ba-9041-56d5-b70f-7a7375880e4a

Problem

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

complete prompt

import pandas as pd
from random import uniform


def task_func(n_data_points=1000, min_value=0.0, max_value=10.0, column_name='Value'):
    """
    Generate a random dataset of floating-point numbers, truncate each value to 3 decimal places, then return the generated DataFrame with
    the specified column name.

    Parameters:
    n_data_points (int, optional): The number of data points to generate. Default is 1000.
    min_value (float, optional): The minimum value for the generated data. Default is 0.0.
    max_value (float, optional): The maximum value for the generated data. Default is 10.0.
    column_name (str, optional): The column name in generated DataFrame. Default is 'Value'.


    Returns:
    DataFrame: A pandas DataFrame with the generated data.
    
    Requirements:
    - pandas
    - random.uniform

    Example:
    >>> random.seed(0)
    >>> data = task_func()
    >>> data.shape[0]
    1000
    """

instruct prompt

Generate a random dataset of floating-point numbers, truncate each value to 3 decimal places, then return the generated DataFrame with the specified column name.
The function should output with:
    DataFrame: A pandas DataFrame with the generated data.
You should write self-contained code starting with:

Code

import pandas as pd
from random import uniform
def task_func(n_data_points=1000, min_value=0.0, max_value=10.0, column_name='Value'):

code prompt

Code

import pandas as pd
from random import uniform
def task_func(n_data_points=1000, min_value=0.0, max_value=10.0, column_name='Value'):

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