benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 2b67184b-8076-5b0c-a655-fee9dbb7cadf

Problem

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

complete prompt

import matplotlib
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler

def task_func(df):
    """
    Standardize 'Age' and 'Score' columns in a pandas DataFrame, remove duplicate entries based on 'Name', and plot a scatter plot of these standardized values.

    Parameters:
    df (pandas.DataFrame): DataFrame containing 'Name', 'Age', and 'Score' columns.

    Returns:
    pandas.DataFrame: DataFrame with standardized 'Age' and 'Score', duplicates removed.
    matplotlib.axes.Axes: Axes object of the scatter plot.

    Note:
    - The function use "Scatter Plot of Standardized Age and Score" for the plot title.
    - The function use "Age (standardized)" and "Score (standardized)" as the xlabel and ylabel respectively.

    Requirements:
    - pandas
    - numpy
    - matplotlib.pyplot
    - sklearn.preprocessing

    Example:
    >>> import pandas as pd
    >>> data = pd.DataFrame([{'Name': 'James', 'Age': 30, 'Score': 85},{'Name': 'James', 'Age': 35, 'Score': 90},{'Name': 'Lily', 'Age': 28, 'Score': 92},{'Name': 'Sam', 'Age': 40, 'Score': 88},{'Name': 'Nick', 'Age': 50, 'Score': 80}])
    >>> modified_df, plot_axes = task_func(data)
    >>> modified_df.head()
        Name       Age     Score
    0  James -0.797724 -0.285365
    2   Lily -1.025645  1.312679
    3    Sam  0.341882  0.399511
    4   Nick  1.481487 -1.426825
    """

instruct prompt

Standardize 'Age' and 'Score' columns in a pandas DataFrame, remove duplicate entries based on 'Name', and plot a scatter plot of these standardized values.
Note that: The function use "Scatter Plot of Standardized Age and Score" for the plot title. The function use "Age (standardized)" and "Score (standardized)" as the xlabel and ylabel respectively.
The function should output with:
    pandas.DataFrame: DataFrame with standardized 'Age' and 'Score', duplicates removed.
    matplotlib.axes.Axes: Axes object of the scatter plot.
You should write self-contained code starting with:

Code

import matplotlib
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
def task_func(df):

code prompt

Code

import matplotlib
import matplotlib.pyplot as plt
from sklearn.preprocessing import StandardScaler
def task_func(df):

entry point

task_func

libs

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