benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf afe43bf9-da05-5c1e-acd0-0d16ab3ee8e0

Problem

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

complete prompt

import pandas as pd
import seaborn as sns


def task_func(goals, penalties):
    """
    Visualize the distribution of goals and penalties for a number of teams and return the data as a
    DataFrame with colomns 'Team', 'Goals' and 'Penalties'.

    Parameters:
    - goals (dict): A dictionary where keys are team names and values are numbers of goals scored.
    - penalties (dict): A dictionary where keys are team names and values are numbers of penalties incurred.

    Returns:
    tuple: A tuple containing:
        - DataFrame: A pandas DataFrame with the goals and penalties for the teams.
        - Axes: A seaborn pairplot visualization of goals and penalties distribution for the teams.

    Requirements:
    - pandas
    - seaborn

    Example:
    >>> goals = {'Team A': 3, 'Team B': 2, 'Team C': 1, 'Team D': 0, 'Team E': 2}
    >>> penalties = {'Team A': 1, 'Team B': 0, 'Team C': 2, 'Team D': 3, 'Team E': 1}
    >>> df, plot = task_func(goals, penalties)
    >>> print(df)
         Team  Goals  Penalties
    0  Team A      3          1
    1  Team B      2          0
    2  Team C      1          2
    3  Team D      0          3
    4  Team E      2          1
    """

instruct prompt

Visualize the distribution of goals and penalties for a number of teams and return the data as a DataFrame with colomns 'Team', 'Goals' and 'Penalties'.
The function should output with:
    tuple: A tuple containing:
    DataFrame: A pandas DataFrame with the goals and penalties for the teams.
    Axes: A seaborn pairplot visualization of goals and penalties distribution for the teams.
You should write self-contained code starting with:

Code

import pandas as pd
import seaborn as sns
def task_func(goals, penalties):

code prompt

Code

import pandas as pd
import seaborn as sns
def task_func(goals, penalties):

entry point

task_func

libs

  • pandas
  • seaborn

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