benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 0d99a3b5-0103-5bd1-babf-1018da2b2299

Problem

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

complete prompt

import numpy as np
from scipy import stats

def task_func(df):
    """
    Given a Pandas DataFrame with random numeric values test if the data in each column is normally distributed using the Shapiro-Wilk test.

    Parameters:
    - df (DataFrame): A Pandas DataFrame with random numeric values.
    
    Returns:
    - dict: A dictionary with p-values from the Shapiro-Wilk test for each column.

    Requirements:
    - numpy
    - scipy

    Example:
    >>> np.random.seed(42)
    >>> df = pd.DataFrame(np.random.normal(size=(100, 5)))
    >>> p_values = task_func(df)
    >>> print(p_values)
    {0: 0.3595593273639679, 1: 0.23594242334365845, 2: 0.7625704407691956, 3: 0.481273353099823, 4: 0.13771861791610718}
    """

instruct prompt

Given a Pandas DataFrame with random numeric values test if the data in each column is normally distributed using the Shapiro-Wilk test.
The function should output with:
    dict: A dictionary with p-values from the Shapiro-Wilk test for each column.
You should write self-contained code starting with:

Code

import numpy as np
from scipy import stats
def task_func(df):

code prompt

Code

import numpy as np
from scipy import stats
def task_func(df):

entry point

task_func

libs

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