benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 51ae926e-5b27-512d-8f49-f85bea3ce3a5

Problem

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

complete prompt

import numpy as np
import random
from datetime import datetime

def task_func(rows=3, columns=2, start_date=datetime(2021, 1, 1), end_date=datetime(2021, 12, 31), seed=0):
    """
    Generates a matrix of given dimensions (rows x columns) containing unique dates between 
    a specified start date and end date.
    
    Parameters:
    - rows (int): The number of rows for the output matrix. Default is 3.
    - columns (int): The number of columns for the output matrix. Default is 2.
    - start_date (datetime): The start date for the range of unique dates. Default is datetime(2021, 1, 1).
    - end_date (datetime): The end date for the range of unique dates. Default is datetime(2021, 12, 31).
    
    Returns:
    - ndarray: A numpy ndarray with unique dates in the shape (rows, columns).
    
    Requirements:
    - numpy
    - itertools
    - datetime
    - random
    
    Example:
    >>> matrix = task_func(2, 2, datetime(2021, 1, 1), datetime(2021, 1, 10))
    >>> print(matrix)
    [['2021-01-03T00:00:00.000000000', '2021-01-07T00:00:00.000000000'],
     ['2021-01-09T00:00:00.000000000', '2021-01-04T00:00:00.000000000']]
    """

instruct prompt

Generates a matrix of given dimensions (rows x columns) containing unique dates between a specified start date and end date.
The function should output with:
    ndarray: A numpy ndarray with unique dates in the shape (rows, columns).
You should write self-contained code starting with:

Code

import numpy as np
import random
from datetime import datetime
def task_func(rows=3, columns=2, start_date=datetime(2021, 1, 1), end_date=datetime(2021, 12, 31), seed=0):

code prompt

Code

import numpy as np
import random
from datetime import datetime
def task_func(rows=3, columns=2, start_date=datetime(2021, 1, 1), end_date=datetime(2021, 12, 31), seed=0):

entry point

task_func

libs

  • datetime
  • numpy
  • random

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