benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf a9130596-70ac-596d-a9fa-07be6e3e3b79

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(data_size=1000, column_names=['A', 'B', 'C', 'D', 'E'], seed=0):
    """
    Generate a Pandas DataFrame with random numeric values between 1 and 100, inclusive, and replace all occurrences of values less than 10 with -1.
    
    Requirements:
    - pandas
    - numpy
    
    Parameters:
    - data_size (int, optional): The number of rows in the DataFrame. Defaults to 1000.
    - column_names (list of str, optional): Names of the DataFrame columns. Defaults to ['A', 'B', 'C', 'D', 'E'].

    Returns:
    - DataFrame: The modified Pandas DataFrame.
    
    Examples:
    >>> df = task_func(data_size=100, column_names=['X', 'Y', 'Z'], seed=42)
    >>> df.shape
    (100, 3)
    """

instruct prompt

Generate a Pandas DataFrame with random numeric values between 1 and 100, inclusive, and replace all occurrences of values less than 10 with -1.
The function should output with:
    DataFrame: The modified Pandas DataFrame.
You should write self-contained code starting with:

Code

import pandas as pd
import numpy as np
def task_func(data_size=1000, column_names=['A', 'B', 'C', 'D', 'E'], seed=0):

code prompt

Code

import pandas as pd
import numpy as np
def task_func(data_size=1000, column_names=['A', 'B', 'C', 'D', 'E'], seed=0):

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