benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf c92b3228-c48f-5aa0-8a55-8651bb1f6c54

Problem

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

complete prompt

import numpy as np
import seaborn as sns


def task_func(arr):
    """
    Plots a heatmap of a given 2D numerical array and prints the sum of each row.
    The heatmap's color range is set based on the minimum and maximum values in the array.

    Parameters:
    arr (numpy.array): A 2D numpy array of numerical values.

    Returns:
    ax (matplotlib.axes.Axes): The Axes object with the plotted heatmap.

    Requirements:
    - numpy
    - seaborn

    Note:
    The function calculates the sum of each row and prints these values.
    The heatmap is plotted based on the original array with its color range set from the minimum to the maximum value in the array.

    Example:
    >>> arr = np.array([[i + j for i in range(3)] for j in range(5)])
    >>> ax = task_func(arr)
    >>> ax.get_title()
    'Heatmap of the 2D Array'
    """

instruct prompt

Plots a heatmap of a given 2D numerical array and prints the sum of each row. The heatmap's color range is set based on the minimum and maximum values in the array.
Note that: The function calculates the sum of each row and prints these values. The heatmap is plotted based on the original array with its color range set from the minimum to the maximum value in the array.
The function should output with:
    ax (matplotlib.axes.Axes): The Axes object with the plotted heatmap.
You should write self-contained code starting with:

Code

import numpy as np
import seaborn as sns
def task_func(arr):

code prompt

Code

import numpy as np
import seaborn as sns
def task_func(arr):

entry point

task_func

libs

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