benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 9ae89a10-c1f7-5f71-81c6-5f0031d8c956

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
from scipy import stats

def task_func(n_data_points=5000, min_value=0.0, max_value=10.0):
    """
    Generate a random dataset of floating-point numbers within a specified range, 
    truncate each value to 3 decimal places, and calculate statistical measures (mean, median, mode) of the data.
    
    Parameters:
    n_data_points (int): Number of data points to generate. Default is 5000.
    min_value (float): Minimum value range for data points. Default is 0.0.
    max_value (float): Maximum value range for data points. Default is 10.0.

    Returns:
    dict: A dictionary with keys 'mean', 'median', 'mode' and their corresponding calculated values.
    
    Requirements:
    - pandas
    - random
    - scipy.stats

    Example:
    >>> random.seed(0)
    >>> stats = task_func(1000, 5.0, 5.0)
    >>> print(stats)
    {'mean': 5.0, 'median': 5.0, 'mode': 5.0}
    """

instruct prompt

Generate a random dataset of floating-point numbers within a specified range, truncate each value to 3 decimal places, and calculate statistical measures (mean, median, mode) of the data.
The function should output with:
    dict: A dictionary with keys 'mean', 'median', 'mode' and their corresponding calculated values.
You should write self-contained code starting with:

Code

import pandas as pd
import random
from scipy import stats
def task_func(n_data_points=5000, min_value=0.0, max_value=10.0):

code prompt

Code

import pandas as pd
import random
from scipy import stats
def task_func(n_data_points=5000, min_value=0.0, max_value=10.0):

entry point

task_func

libs

  • pandas
  • random
  • scipy

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