benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1f89136b-e89c-5f0e-85d3-67dcf49f66d8

Problem

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

complete prompt

import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler

# Constants
PLOT_TITLE = "Scaled Values"


def task_func(data_dict):
    """
    Scales the values in a given dictionary using MinMaxScaler and plots the scaled data.

    Parameters:
    - data_dict (dict): A dictionary where keys represent column names and values are lists of numerical data.
                        The values may contain missing data (None), which are handled by dropping them before scaling.

    Returns:
    - pandas.DataFrame containing the scaled data.
    - matplotlib Axes object that displays the plot of the scaled data.

    Requirements:
    - pandas
    - scikit-learn
    - matplotlib

    Example:
    >>> data = {'a': [1, 2, None, 4], 'b': [5, None, 7, 8]}
    >>> scaled_df, plot_ax = task_func(data)
    >>> scaled_df
         a    b
    0  0.0  0.0
    1  1.0  1.0
    >>> plot_ax.get_title()
    'Scaled Values'
    """

instruct prompt

Scales the values in a given dictionary using MinMaxScaler and plots the scaled data.
The function should output with:
    pandas.DataFrame containing the scaled data.
    matplotlib Axes object that displays the plot of the scaled data.
You should write self-contained code starting with:

Code

import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
# Constants
PLOT_TITLE = "Scaled Values"
def task_func(data_dict):

code prompt

Code

import pandas as pd
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
# Constants
PLOT_TITLE = "Scaled Values"
def task_func(data_dict):

entry point

task_func

libs

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