benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 8a4bb245-62ea-54b1-9132-a64cb64ecbc5

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
import random

def task_func(rows=3, cols=2, min_val=0, max_val=100, seed=0):
    """
    Creates a matrix of specified dimensions with random integers within a given range,
    and then converts it into a pandas DataFrame.
    
    Parameters:
    - rows (int): Number of rows in the matrix. Default is 3.
    - cols (int): Number of columns in the matrix. Default is 2.
    - min_val (int): Minimum integer value for the random integers. Default is 0.
    - max_val (int): Maximum integer value for the random integers. Default is 100.
    
    Returns:
    DataFrame: A pandas DataFrame containing random integers within the specified range.
    
    Requirements:
    - numpy
    - pandas
    - random

    Example:
    >>> df = task_func(3, 2, 0, 100)
    >>> print(type(df))
    <class 'pandas.core.frame.DataFrame'>
    >>> print(df.shape)
    (3, 2)
    """

instruct prompt

Creates a matrix of specified dimensions with random integers within a given range, and then converts it into a pandas DataFrame.
The function should output with:
    DataFrame: A pandas DataFrame containing random integers within the specified range.
You should write self-contained code starting with:

Code

import numpy as np
import pandas as pd
import random
def task_func(rows=3, cols=2, min_val=0, max_val=100, seed=0):

code prompt

Code

import numpy as np
import pandas as pd
import random
def task_func(rows=3, cols=2, min_val=0, max_val=100, seed=0):

entry point

task_func

libs

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