benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 77000c52-806c-59ff-8389-a54b420f7178

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
# Constants
LETTERS = list('abcdefghijklmnopqrstuvwxyz')


def task_func(data, letter):
    """
    Filters rows in a dictionary where the 'Name' column values start with a specified letter.
    First, convert the dict to a DataFrame and then filter rows in this DataFrame.

    Parameters:
    - df (dic of list): The input dict. It should have a 'Name' key.
    - letter (str): The letter to filter the 'Name' column by.

    Returns:
    - pd.Series: A Series of filtered 'Name' column.

    Requirements:
    - pandas
    - time

    Example:
    >>> data = {'Name': ['Alice', 'Bob', 'Charlie', 'David', 'Eva', 'Fiona']}
    >>> filtered_names = task_func(data, 'a')
    >>> filtered_names.index[0].startswith('A')
    True
    >>> len(filtered_names)
    1
    """

instruct prompt

Filters rows in a dictionary where the 'Name' column values start with a specified letter. First, convert the dict to a DataFrame and then filter rows in this DataFrame.
The function should output with:
    pd.Series: A Series of filtered 'Name' column.
You should write self-contained code starting with:

Code

import pandas as pd
import time
# Constants
LETTERS = list('abcdefghijklmnopqrstuvwxyz')
def task_func(data, letter):

code prompt

Code

import pandas as pd
import time
# Constants
LETTERS = list('abcdefghijklmnopqrstuvwxyz')
def task_func(data, 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