benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 244b2b50-c634-5442-b612-60acb7a145a7

Problem

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

complete prompt

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats

# Constants
TARGET_VALUE = '332'
ARRAY = np.array([['0', '1', '2'], ['a', 'bb', 'ccc'], ['332', '33', '2'], ['33', '22', '332']])


def task_func(target_value=TARGET_VALUE, array=ARRAY):
    """
    Finds the row indices in a numpy array where the first cell matches target_value "332"
    Performs statistical analysis on these indices and plots their distribution.
    Return 'N/A' for all stats if no target value found.

    Parameters:
    - target_value (str): The target value. Default value is '332'
    - array (np.ndarray): The input array

    Returns:
    tuple: A tuple with mean, variance, skewness, and kurtosis of the indices, or
           'N/A' if statistical analysis cannot be performed.

    Requirements:
    - numpy
    - scipy.stats
    - matplotlib.pyplot

    Example:
    >>> task_func()
    (2.0, 'N/A', 'N/A', 'N/A')
    """

instruct prompt

Finds the row indices in a numpy array where the first cell matches target_value "332" Performs statistical analysis on these indices and plots their distribution. Return 'N/A' for all stats if no target value found.
The function should output with:
    tuple: A tuple with mean, variance, skewness, and kurtosis of the indices, or
    'N/A' if statistical analysis cannot be performed.
You should write self-contained code starting with:

Code

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
# Constants
TARGET_VALUE = '332'
ARRAY = np.array([['0', '1', '2'], ['a', 'bb', 'ccc'], ['332', '33', '2'], ['33', '22', '332']])
def task_func(target_value=TARGET_VALUE, array=ARRAY):

code prompt

Code

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
# Constants
TARGET_VALUE = '332'
ARRAY = np.array([['0', '1', '2'], ['a', 'bb', 'ccc'], ['332', '33', '2'], ['33', '22', '332']])
def task_func(target_value=TARGET_VALUE, array=ARRAY):

entry point

task_func

libs

  • numpy
  • matplotlib
  • 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