benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f406acc4-945a-5093-98f6-4cb7bd485ce6

Problem

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

complete prompt

import pandas as pd
import seaborn as sns

def task_func(data='/path/to/data.csv', emp_prefix='EMP'):
    """
    Load a CSV file into a DataFrame, filter the lines in which the employee ID begins with a prefix, and draw a histogram of its age.

    Parameters:
    - data (str): The path to the data file. Default is '/path/to/data.csv'.
    - emp_prefix (str): The prefix of the employee IDs. Default is 'EMP$$'.

    Returns:
    - DataFrame: A pandas DataFrame with the filtered data, containing the columns 'Employee ID' and 'Age'.
    - Axes: A histogram plot of the 'Age' column of the filtered data.

    Requirements:
    - pandas
    - seaborn

    Example:
    >>> df, ax = task_func()
    >>> print(df)
    """

instruct prompt

Load a CSV file into a DataFrame, filter the lines in which the employee ID begins with a prefix, and draw a histogram of its age.
The function should output with:
    DataFrame: A pandas DataFrame with the filtered data, containing the columns 'Employee ID' and 'Age'.
    Axes: A histogram plot of the 'Age' column of the filtered data.
You should write self-contained code starting with:

Code

import pandas as pd
import seaborn as sns
def task_func(data='/path/to/data.csv', emp_prefix='EMP'):

code prompt

Code

import pandas as pd
import seaborn as sns
def task_func(data='/path/to/data.csv', emp_prefix='EMP'):

entry point

task_func

libs

  • pandas
  • seaborn

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