benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 5450f24b-37ff-50ae-b8bd-6413a3a2d5ae

Problem

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

complete prompt

from datetime import datetime
import random
import matplotlib.pyplot as plt


def task_func(
    epoch_milliseconds,
    teams=["Team1", "Team2", "Team3", "Team4", "Team5"],
    random_seed=0,
):
    """
    Generate and plot a performance trend for different teams from a given epoch timestamp to the current time.

    The performance data is generated by creating a series of random values for each day from the starting timestamp
    to the present day. Each team's performance is simulated as a random float between 0.1 and 1 for each day.
    The plot shows days since the start date on the x-axis and performance on the y-axis.

    Parameters:
    epoch_milliseconds (int): The epoch milliseconds from where to start the generation. Must not be in the future.
    teams (list of str, optional): Team names. If not provided, defaults to ['Team1', 'Team2', 'Team3', 'Team4', 'Team5'].
    random_seed (int, optional): Seed for random number generation to ensure reproducibility. Defaults to 0.

    Returns:
    dict: A dictionary containing performance data for each team, with days as indices and performance as float values.
    matplotlib.figure.Figure: A figure object showing the performance trend of each team over the days.

    Requirements:
    - datetime.datetime
    - random
    - matplotlib

    Example:
    >>> results, ax = task_func(1236472051807)
    >>> results.keys()
    dict_keys(['Team1', 'Team2', 'Team3', 'Team4', 'Team5'])
    >>> type(ax)
    <class 'matplotlib.figure.Figure'>
    """

instruct prompt

Generate and plot a performance trend for different teams from a given epoch timestamp to the current time. The performance data is generated by creating a series of random values for each day from the starting timestamp to the present day. Each team's performance is simulated as a random float between 0.1 and 1 for each day. The plot shows days since the start date on the x-axis and performance on the y-axis.
The function should output with:
    dict: A dictionary containing performance data for each team, with days as indices and performance as float values.
    matplotlib.figure.Figure: A figure object showing the performance trend of each team over the days.
You should write self-contained code starting with:

Code

from datetime import datetime
import random
import matplotlib.pyplot as plt
def task_func(
    epoch_milliseconds,
    teams=["Team1", "Team2", "Team3", "Team4", "Team5"],
    random_seed=0,
):

code prompt

Code

from datetime import datetime
import random
import matplotlib.pyplot as plt
def task_func(
    epoch_milliseconds,
    teams=["Team1", "Team2", "Team3", "Team4", "Team5"],
    random_seed=0,
):

entry point

task_func

libs

  • datetime
  • random
  • matplotlib

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