benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf cd06b920-4f35-5aa1-b2b0-0d71f068b828

Problem

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

complete prompt

import pandas as pd
from sklearn.linear_model import LinearRegression

DATA = {
    "Area_String": ["1,000", "2,000", "3,000", "4,000", "5,000"],
    "Price": [100, 200, 300, 400, 500],
}


def task_func(area_string, data=DATA):
    """
    Predicts the price based on a given area after training a linear regression model.

    Parameters:
    - area_string (str): A string representing the area (in square units) for
    which the price needs to be predicted. The string may contain commas.
    - data (dict): Optional. A dictionary with keys 'Area_String' and 'Price'
    representing area values (as strings) and their corresponding prices. Defaults to a predefined dataset.

    Returns:
    - float: The predicted price for the given area.

    Requirements:
    - pandas
    - sklearn.linear_model

    Example:
    >>> task_func('6,000')
    600.0
    """

instruct prompt

Predicts the price based on a given area after training a linear regression model.
The function should output with:
    float: The predicted price for the given area.
You should write self-contained code starting with:

Code

import pandas as pd
from sklearn.linear_model import LinearRegression
DATA = {
    "Area_String": ["1,000", "2,000", "3,000", "4,000", "5,000"],
    "Price": [100, 200, 300, 400, 500],
}
def task_func(area_string, data=DATA):

code prompt

Code

import pandas as pd
from sklearn.linear_model import LinearRegression
DATA = {
    "Area_String": ["1,000", "2,000", "3,000", "4,000", "5,000"],
    "Price": [100, 200, 300, 400, 500],
}
def task_func(area_string, data=DATA):

entry point

task_func

libs

  • pandas
  • sklearn

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