benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 9514f7e2-96d8-5483-8cba-524822cf61ac

Problem

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

complete prompt

import matplotlib.pyplot as plt
import seaborn as sns


def task_func(dataframe, target_value='332'):
    """
    Searches a given DataFrame for occurrences of a specified target value and visualizes these occurrences using a heatmap.

    Parameters:
    - dataframe (pd.DataFrame): The input DataFrame to search.
    - target_value (str, optional): The value to search for in the DataFrame. Defaults to '332'.

    Returns:
    - tuple: A tuple containing:
        - pd.DataFrame: A DataFrame with Boolean values indicating the presence of the target value in the input DataFrame.
        - matplotlib.axes._axes.Axes: The Axes object of the heatmap.

    Requirements:
    - matplotlib.pyplot
    - seaborn

    Example:
    >>> import pandas as pd
    >>> df = pd.DataFrame({
    ...     'Column1': ['0', 'a', '332', '33'],
    ...     'Column2': ['1', 'bb', '33', '22'],
    ...     'Column3': ['2', 'ccc', '2', '332']
    ... })
    >>> mask, ax = task_func(df, '332')
    """

instruct prompt

Searches a given DataFrame for occurrences of a specified target value and visualizes these occurrences using a heatmap.
The function should output with:
    tuple: A tuple containing:
    pd.DataFrame: A DataFrame with Boolean values indicating the presence of the target value in the input DataFrame.
    matplotlib.axes._axes.Axes: The Axes object of the heatmap.
You should write self-contained code starting with:

Code

import matplotlib.pyplot as plt
import seaborn as sns
def task_func(dataframe, target_value='332'):

code prompt

Code

import matplotlib.pyplot as plt
import seaborn as sns
def task_func(dataframe, target_value='332'):

entry point

task_func

libs

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