benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f61f226c-486e-5ec6-9ff2-a9f7a061f29d

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, target_value):
    '''
    Convert the input dic of list to DataFrame and searcher in this DataFrame for rows with cells equal to the
    provided target_value. It then plots the count of such rows per column.

    Parameters:
    - df (dic of list): The input dict. It should have a 'Name' key.
    - target_value (str): The target value to be searched in the DataFrame.

    Returns:
    tuple: A tuple containing:
        - A pandas Series with counts of the target value per column.
        - A matplotlib Axes object representing the plot (None if dataframe is empty).

    Requirements:
    - pandas
    - time

    Example:
    >>> df = {'Column1': ['0', 'a', '332', '33']}
    >>> series, ax = task_func(df, '332')
    '''

instruct prompt

Convert the input dic of list to DataFrame and searcher in this DataFrame for rows with cells equal to the provided target_value. It then plots the count of such rows per column.
The function should output with:
    tuple: A tuple containing:
    A pandas Series with counts of the target value per column.
    A matplotlib Axes object representing the plot (None if dataframe is empty).
You should write self-contained code starting with:

Code

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

code prompt

Code

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

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