benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e1a4b8b8-d20a-5e69-93cb-001940c609ba

Problem

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

complete prompt

import pandas as pd
from random import randint


def task_func(name: str, age: int, code: str, salary: float, bio: str) -> pd.DataFrame:
    """
    Generate a Pandas DataFrame of employees with their details based on the input provided.

    Parameters:
    - name (str): Name of the employee. This is case-sensitive. Must be one of the predefined
                  names: 'John', 'Alice', 'Bob', 'Charlie', 'David', otherwise the function raises
                  ValueError.
    - age (int): Age of the employee.
    - code (str): Code of the employee.
    - salary (float): Salary of the employee.
    - bio (str): Biography of the employee.

    Returns:
    data_df (pd.DataFrame): dataframe with columns: 'Name', 'Age', 'Code', 'Salary', 'Bio', 'Job Title'.
               The 'Job Title' is randomly assigned from the predefined job titles:
               'Engineer', 'Manager', 'Analyst', 'Developer', 'Tester'.

    Requirements:
    - pandas
    - random.randint

    Example:
    >>> random.seed(0)
    >>> df = task_func("John", 30, "A10B", 5000.0, "This is a bio with spaces")
    >>> print(df)
       Name  Age  Code  Salary                        Bio  Job Title
    0  John   30  A10B  5000.0  This is a bio with spaces  Developer
    """

instruct prompt

Generate a Pandas DataFrame of employees with their details based on the input provided.
The function should output with:
    data_df (pd.DataFrame): dataframe with columns: 'Name', 'Age', 'Code', 'Salary', 'Bio', 'Job Title'.
    The 'Job Title' is randomly assigned from the predefined job titles:
    'Engineer', 'Manager', 'Analyst', 'Developer', 'Tester'.
You should write self-contained code starting with:

Code

import pandas as pd
from random import randint
def task_func(name: str, age: int, code: str, salary: float, bio: str) -> pd.DataFrame:

code prompt

Code

import pandas as pd
from random import randint
def task_func(name: str, age: int, code: str, salary: float, bio: str) -> pd.DataFrame:

entry point

task_func

libs

  • pandas
  • random

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