benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 86e688f2-2839-5e61-948a-3af723729337

Problem

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

complete prompt

import pandas as pd
import re
import random


def task_func(data_list, seed=None):
    """
    Removes a random comma-separated value (treated as a "substring") from each string
    in a list and returns a pandas DataFrame containing the original and modified strings.

    Parameters:
    - data_list (list of str): A list of comma-separated strings. The function will remove
                               leading and trailing whitespaces first before processing.
    - seed (int, optional): Seed for the random number generator for reproducibility.
      Default is None, which uses system time.

    Returns:
    - DataFrame: A pandas DataFrame with columns 'Original String' and 'Modified String'.

    Requirements:
    - pandas
    - re
    - random

    Example:
    >>> task_func(['lamp, bag, mirror', 'table, chair, bag, lamp'], seed=42)
               Original String   Modified String
    0        lamp, bag, mirror         lamp, bag
    1  table, chair, bag, lamp  chair, bag, lamp
    """

instruct prompt

Removes a random comma-separated value (treated as a "substring") from each string in a list and returns a pandas DataFrame containing the original and modified strings.
The function should output with:
    DataFrame: A pandas DataFrame with columns 'Original String' and 'Modified String'.
You should write self-contained code starting with:

Code

import pandas as pd
import re
import random
def task_func(data_list, seed=None):

code prompt

Code

import pandas as pd
import re
import random
def task_func(data_list, seed=None):

entry point

task_func

libs

  • pandas
  • random
  • re

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