benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 279507cf-89a1-57f9-8bac-a519fca2b747

Problem

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

complete prompt

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt

def task_func(l):
    '''
    Draw a histogram of the given array with a Gaussian fit.

    Parameters:
    l (numpy array): The input array.

    Returns:
    ax (matplotlib.axes._axes.Axes): Axes object with the plot.

    Note:
    - This function use "Fit results: mu = {mean},  std = {standard deviation}" as the title of the plot, 
    where the values are rounded to two decimal points.


    Requirements:
    - numpy
    - scipy.stats
    - matplotlib.pyplot

    Example:
    >>> l = np.array([5, 5, 5, 5, 5])
    >>> ax = task_func(l)
    >>> print(ax.get_title())
    Fit results: mu = 5.00,  std = 0.00
    >>> plt.close()
    '''

instruct prompt

Draw a histogram of the given array with a Gaussian fit.
Note that: This function use "Fit results: mu = {mean},  std = {standard deviation}" as the title of the plot, where the values are rounded to two decimal points.
The function should output with:
    ax (matplotlib.axes._axes.Axes): Axes object with the plot.
You should write self-contained code starting with:

Code

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def task_func(l):

code prompt

Code

import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
def task_func(l):

entry point

task_func

libs

  • numpy
  • matplotlib
  • scipy

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