benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 53cdcc94-1f81-5e6e-b494-7e6ef2e24789

Problem

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

complete prompt

import statistics
import matplotlib.pyplot as plt


def task_func(sales_data):
    """
    Plot sales trends for five products over a year, highlighting variability with standard deviation shading
    with 'Month' on x-axis and 'Sales' on y-axis.

    Parameters:
    - sales_data (pd.DataFrame): DataFrame with sales data, expected columns: 'Month', 'Product A' to 'Product E'.

    Returns:
    - ax (matplotlib.axes.Axes): Axes object with the sales trends plot.

    Requirements:
    - matplotlib.pyplot
    - statistics

    Example:
    >>> import pandas as pd, numpy as np
    >>> sales_data = pd.DataFrame({
    ...     'Month': range(1, 13),
    ...     'Product A': np.random.randint(100, 200, size=12),
    ...     'Product B': np.random.randint(150, 250, size=12),
    ...     'Product C': np.random.randint(120, 220, size=12),
    ...     'Product D': np.random.randint(130, 230, size=12),
    ...     'Product E': np.random.randint(140, 240, size=12)
    ... })
    >>> ax = task_func(sales_data)
    >>> plt.show()  # Displays the plot
    """

instruct prompt

Plot sales trends for five products over a year, highlighting variability with standard deviation shading with 'Month' on x-axis and 'Sales' on y-axis.
The function should output with:
    ax (matplotlib.axes.Axes): Axes object with the sales trends plot.
You should write self-contained code starting with:

Code

import statistics
import matplotlib.pyplot as plt
def task_func(sales_data):

code prompt

Code

import statistics
import matplotlib.pyplot as plt
def task_func(sales_data):

entry point

task_func

libs

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