benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 55eedb03-d3cc-5c03-8ad7-3e3ea85faafb

Problem

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

complete prompt

import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler

def task_func(df, features):
    """
    Standardize the functions in a DataFrame.
    The function applies standard scaling to the features.
    
    Parameters:
    - df (pandas.DataFrame): The input DataFrame.
    - features (list): The list of features to standardize. May be empty.
    
    Returns:
    - df (pandas.DataFrame): The DataFrame with the standardized features.

    Requirements:
    - pandas
    - numpy
    - scikit-learn

    Example:
    >>> np.random.seed(42)
    >>> df = pd.DataFrame(np.random.randn(20, 3), columns=['a', 'b', 'c'])
    >>> df = task_func(df, ['a', 'b'])
    >>> df.head(2)
              a         b         c
    0  0.608932  0.127900  0.647689
    1  2.025355  0.031682 -0.234137
    """

instruct prompt

Standardize the functions in a DataFrame. The function applies standard scaling to the features.
The function should output with:
    df (pandas.DataFrame): The DataFrame with the standardized features.
You should write self-contained code starting with:

Code

import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
def task_func(df, features):

code prompt

Code

import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
def task_func(df, features):

entry point

task_func

libs

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