benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 6d2127f9-c0dc-5859-b166-1b30b8f91ce2

Problem

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

complete prompt

import seaborn as sns
import time

def task_func(df, letter):
    """
    Filters rows in a DataFrame based on the starting letter of the values in the 'Word' column.
    It then calculates the lengths of these words and returns a box plot representing the distribution
    of these lengths.

    Parameters:
    - df (pd.DataFrame): The input DataFrame containing a 'Word' column with string values.
    - letter (str): A lowercase letter to filter words in the 'Word' column.

    Returns:
    - Axes: A box plot visualizing the distribution of the word lengths for words starting
                   with the specified letter. If the DataFrame is empty or the 'Word' column is missing,
                   returns None.

    Requirements:
    - seaborn
    - time

    Example:
    >>> import pandas as pd
    >>> words = ['apple', 'banana', 'cherry', 'date', 'apricot', 'blueberry', 'avocado']
    >>> df = pd.DataFrame({'Word': words})
    >>> _ = task_func(df, 'apple')
    """

instruct prompt

Filters rows in a DataFrame based on the starting letter of the values in the 'Word' column. It then calculates the lengths of these words and returns a box plot representing the distribution of these lengths.
The function should output with:
    Axes: A box plot visualizing the distribution of the word lengths for words starting
    with the specified letter. If the DataFrame is empty or the 'Word' column is missing,
    returns None.
You should write self-contained code starting with:

Code

import seaborn as sns
import time
def task_func(df, letter):

code prompt

Code

import seaborn as sns
import time
def task_func(df, letter):

entry point

task_func

libs

  • time
  • 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