benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5f3c167f-cf69-51ee-9c94-3f2264f22670

Problem

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

complete prompt

import pandas as pd
from sklearn.preprocessing import StandardScaler

def task_func(df):
    """
    Given a Pandas DataFrame with random numeric values, standardize it with the standard scaler from sklearn.

    Parameters:
    - df (DataFrame): The DataFrame to be standardized.
    
    Returns:
    - df_standardized (DataFrame): The standardized DataFrame.

    Requirements:
    - pandas
    - sklearn

    Example:
    >>> df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
    >>> task_func(df)
              a         b
    0 -1.224745 -1.224745
    1  0.000000  0.000000
    2  1.224745  1.224745
    """

instruct prompt

Given a Pandas DataFrame with random numeric values, standardize it with the standard scaler from sklearn.
The function should output with:
    df_standardized (DataFrame): The standardized DataFrame.
You should write self-contained code starting with:

Code

import pandas as pd
from sklearn.preprocessing import StandardScaler
def task_func(df):

code prompt

Code

import pandas as pd
from sklearn.preprocessing import StandardScaler
def task_func(df):

entry point

task_func

libs

  • pandas
  • sklearn

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