benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf d79b5319-4724-59ff-a35f-a98a9b430839

Problem

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

complete prompt

import pandas as pd
import time

def task_func(df, letter):
    """
    This function converts an input dictionary into a DataFrame, filters rows where 'Word' column values start with a
    specified letter, calculates the lengths of these words, and returns returns a histogram plot of the word lengths.

    Parameters:
    - df (dict of list): A dictionary where the key 'Word' maps to a list of strings.
    - letter (str): The letter to filter the 'Word' column by. It should be a lowercase letter.

    Returns:
    - Axes: A histogram plot of word lengths for words starting with the specified letter.

    Requirements:
    - pandas
    - time

    Example:
    >>> df = {'Word': ['apple', 'banana', 'cherry', 'date', 'fig', 'grape', 'avocado']}
    >>> ax = task_func(df, 'a')
    """

instruct prompt

This function converts an input dictionary into a DataFrame, filters rows where 'Word' column values start with a specified letter, calculates the lengths of these words, and returns returns a histogram plot of the word lengths.
The function should output with:
    Axes: A histogram plot of word lengths for words starting with the specified letter.
You should write self-contained code starting with:

Code

import pandas as pd
import time
def task_func(df, letter):

code prompt

Code

import pandas as pd
import time
def task_func(df, letter):

entry point

task_func

libs

  • pandas
  • time

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