benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf cf310527-add5-5e96-898d-2d8af1b30133

Problem

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

complete prompt

import pandas as pd
import os
import sys

def task_func(file_path: str, column_name: str) -> pd.DataFrame:
    """
    Load a CSV file into a Pandas DataFrame, replace all occurrences of the string '\n' with the string '<br>'
    in the specified column, and return the cleaned DataFrame.
    
    Parameters:
    - file_path (str): The path to the CSV file to be read.
    - column_name (str): The name of the column in which to replace occurrences of '\n' with '<br>'.
    
    Returns:
    - pd.DataFrame: The cleaned Pandas DataFrame.
    
    Requirements:
    - pandas
    - os
    - sys
    
    Examples:
    >>> df = task_func('data.csv', 'Value')
    >>> print(df['Value'].iloc[0])
    "some<br>text"
    >>> df = task_func('another_data.csv', 'Comments')
    >>> print(df['Comments'].iloc[1])
    "hello<br>world"
    """

instruct prompt

Load a CSV file into a Pandas DataFrame, replace all occurrences of the string '\n' with the string '<br>' in the specified column, and return the cleaned DataFrame.
The function should output with:
    pd.DataFrame: The cleaned Pandas DataFrame.
You should write self-contained code starting with:

Code

import pandas as pd
import os
import sys
def task_func(file_path: str, column_name: str) -> pd.DataFrame:

code prompt

Code

import pandas as pd
import os
import sys
def task_func(file_path: str, column_name: str) -> pd.DataFrame:

entry point

task_func

libs

  • pandas
  • os
  • sys

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