benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf ce40c5e7-22ee-50ee-8e09-57363dd73c0e

Problem

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

complete prompt

import pandas as pd
import regex as re

def task_func(text):
    """
    Extract data from a text and create a Pandas DataFrame. The text contains several lines, each formatted as 'Score: 85, Category: Math'. Make sure to convert the scores in integer.

    Parameters:
    text (str): The text to analyze.

    Returns:
    DataFrame: A pandas DataFrame with extracted data.

    Requirements:
    - pandas
    - regex

    Example:
    >>> text = "Score: 85, Category: Math\\nScore: 90, Category: Science\\nScore: 80, Category: Math"
    >>> df = task_func(text)
    >>> print(df)
       Score Category
    0     85     Math
    1     90  Science
    2     80     Math
    """

instruct prompt

Extract data from a text and create a Pandas DataFrame. The text contains several lines, each formatted as 'Score: 85, Category: Math'. Make sure to convert the scores in integer.
The function should output with:
    DataFrame: A pandas DataFrame with extracted data.
You should write self-contained code starting with:

Code

import pandas as pd
import regex as re
def task_func(text):

code prompt

Code

import pandas as pd
import regex as re
def task_func(text):

entry point

task_func

libs

  • regex
  • pandas

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