benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 3ff3e44f-3349-5333-8e06-504be4a63583

Problem

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

complete prompt

import numpy as np
import pandas as pd


def task_func(array_length=100):
    '''
    Generate two arrays of random numbers of a given length, calculate their mean, median, and standard deviation,
    then store these results in a Panda DataFrame 'statistics' with keys 'Array1' and 'Array2'.
    Draw a bar chart to compare these statistics with indices 'Mean', 'Median', and 'Standard Deviation'.

    Parameters:
    - array_length (int, optional): The length of the arrays to be generated. Default is 100.

    Returns:
    - DataFrame: A pandas DataFrame with the statistics of the arrays.
    - Axes: The bar chart plot comparing the statistics.

    Requirements:
    - numpy
    - pandas

    Example:
    >>> df, ax = task_func(50)
    '''

instruct prompt

Generate two arrays of random numbers of a given length, calculate their mean, median, and standard deviation, then store these results in a Panda DataFrame 'statistics' with keys 'Array1' and 'Array2'. Draw a bar chart to compare these statistics with indices 'Mean', 'Median', and 'Standard Deviation'.
The function should output with:
    DataFrame: A pandas DataFrame with the statistics of the arrays.
    Axes: The bar chart plot comparing the statistics.
You should write self-contained code starting with:

Code

import numpy as np
import pandas as pd
def task_func(array_length=100):

code prompt

Code

import numpy as np
import pandas as pd
def task_func(array_length=100):

entry point

task_func

libs

  • pandas
  • numpy

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