benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 8a0b48e3-f62d-5b85-b57d-5c9e11cdc657

Problem

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

complete prompt

import bisect
import statistics

def task_func(df, column, value):
    """
    Analyze a column of a pandas DataFrame, find the values that are larger than the average, and count the number of values that are larger than a given value.

    Parameters:
    df (DataFrame): The pandas DataFrame.
    column (str): The column to analyze.
    value (float): The value to compare with the data in the column.
    
    Returns:
    tuple: A tuple containing (numpy.ndarray, int, matplotlib.axes.Axes).
           The numpy array contains values greater than the average.
           The int is the number of values greater than the given value.
           The Axes object is for the generated histogram plot.

    Raises:
    ValueError: If the column does not exist in the DataFrame or value is not a number.

    Requirements:
    - bisect
    - statistics
    
    Example:
    >>> df = pd.DataFrame({'A': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]})
    >>> greater_avg, num_greater_value, ax = task_func(df, 'A', 5)
    """

instruct prompt

Analyze a column of a pandas DataFrame, find the values that are larger than the average, and count the number of values that are larger than a given value.
The function should raise the exception for: ValueError: If the column does not exist in the DataFrame or value is not a number.
The function should output with:
    tuple: A tuple containing (numpy.ndarray, int, matplotlib.axes.Axes).
    The numpy array contains values greater than the average.
    The int is the number of values greater than the given value.
    The Axes object is for the generated histogram plot.
You should write self-contained code starting with:

Code

import bisect
import statistics
def task_func(df, column, value):

code prompt

Code

import bisect
import statistics
def task_func(df, column, value):

entry point

task_func

libs

  • statistics
  • bisect

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