benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 16b46455-ce0a-5a6e-bf33-da87777619da

Problem

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

complete prompt

import pandas as pd
import numpy as np


def task_func(file_path, num_rows, data_dimensions=5, random_seed=None):
    """
    Creates a CSV file on a given file path with random numeric data. 
    The number of rows in the CSV file is determined by the 'num_rows' parameter, 
    and the number of columns (features) is determined by the 'data_dimensions' parameter.
    Columns are named following the convention: 'Feature_x', where x is the number of the 
    feature column starting at 1.

    Parameters:
    file_path (str): The file path where the CSV file should be created.
    num_rows (int): The number of rows of random data to generate.
    data_dimensions (int, optional): The number of columns (features) in the CSV file. Defaults to 5.
    random_seed (int, optional): Seed used in rng. Defaults to None.
    
    Returns:
    str: The file path of the generated CSV file.

    Requirements:
    - pandas
    - numpy

    Example:
    >>> task_func('/tmp/data.csv', 100)
    '/tmp/data.csv'
    """

instruct prompt

Creates a CSV file on a given file path with random numeric data. The number of rows in the CSV file is determined by the 'num_rows' parameter, and the number of columns (features) is determined by the 'data_dimensions' parameter. Columns are named following the convention: 'Feature_x', where x is the number of the feature column starting at 1.
The function should output with:
    str: The file path of the generated CSV file.
You should write self-contained code starting with:

Code

import pandas as pd
import numpy as np
def task_func(file_path, num_rows, data_dimensions=5, random_seed=None):

code prompt

Code

import pandas as pd
import numpy as np
def task_func(file_path, num_rows, data_dimensions=5, random_seed=None):

entry point

task_func

libs

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