benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 051e9597-9a36-5650-b65d-856782388d61

Problem

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

complete prompt

import numpy as np
import pandas as pd
from datetime import datetime, timedelta

def task_func(start_date, end_date, seed=42):
    """
    Generate random sales data for each day between a start and end date, inclusive.
    Returns the data and a plot of sales over time.

    Parameters:
    start_date (datetime): The start date.
    end_date (datetime): The end date.
    seed (int): Seed for the random number generator. Default is 42.

    Returns:
    DataFrame: A pandas DataFrame with columns 'Date' and 'Sales'.
    Axes: A matplotlib Axes object of the plot showing the sales overtime.
    
    sales ranges 0 to 500 and it is an integer

    Requirements:
    - numpy
    - pandas
    - datetime

    Example:
    >>> start_date = datetime(2021, 1, 1)
    >>> end_date = datetime(2021, 12, 31)
    >>> data, plot = task_func(start_date, end_date)
    >>> print(data.head())
            Date  Sales
    0 2021-01-01    102
    1 2021-01-02    435
    2 2021-01-03    348
    3 2021-01-04    270
    4 2021-01-05    106
    """

instruct prompt

Generate random sales data for each day between a start and end date, inclusive. Returns the data and a plot of sales over time. sales ranges 0 to 500 and it is an integer
The function should output with:
    DataFrame: A pandas DataFrame with columns 'Date' and 'Sales'.
    Axes: A matplotlib Axes object of the plot showing the sales overtime.
You should write self-contained code starting with:

Code

import numpy as np
import pandas as pd
from datetime import datetime, timedelta
def task_func(start_date, end_date, seed=42):

code prompt

Code

import numpy as np
import pandas as pd
from datetime import datetime, timedelta
def task_func(start_date, end_date, seed=42):

entry point

task_func

libs

  • pandas
  • datetime
  • numpy

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