benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf fd7a3900-e0be-5127-b74a-4172337c8359

Problem

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

complete prompt

import pandas as pd
from scipy import stats


def task_func(matrix):
    """
    Normalizes a 2D numeric array (matrix) using the Z score.
    
    Parameters:
    matrix (array): The 2D numpy array.
    
    Returns:
    DataFrame: The normalized DataFrame.

    Requirements:
    - pandas
    - numpy
    - scipy

    Example:
    >>> import numpy as np
    >>> matrix = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
    >>> normalized_df = task_func(matrix)
    >>> isinstance(normalized_df, pd.DataFrame)
    True
    >>> np.allclose(normalized_df.mean(), 0)
    True
    >>> np.allclose(normalized_df.std(ddof=0), 1)
    True
    """

instruct prompt

Normalizes a 2D numeric array (matrix) using the Z score.
The function should output with:
    DataFrame: The normalized DataFrame.
You should write self-contained code starting with:

Code

import pandas as pd
from scipy import stats
def task_func(matrix):

code prompt

Code

import pandas as pd
from scipy import stats
def task_func(matrix):

entry point

task_func

libs

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