benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf db0f2433-b7b1-51de-8dcb-f028c8ec3419

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(df):
    """
    Describe a dataframe and draw a distribution chart for each numeric column after replacing the NaN values with the average of the column.

    Parameters:
    df (DataFrame): The pandas DataFrame.

    Returns:
    tuple: A tuple containing:
        - DataFrame: A pandas DataFrame with statistics. This includes count, mean, standard deviation (std), min, 25%, 50%, 75%, and max values for each numeric column.
        - List[Axes]: A list of matplotlib Axes objects representing the distribution plots for each numeric column.
                    Each plot visualizes the distribution of data in the respective column with 10 bins.

    Requirements:
    - numpy
    - seaborn

    Example:
    >>> import pandas as pd
    >>> import numpy as np
    >>> df = pd.DataFrame([[1,2,3],[4,5,6],[7.0,np.nan,9.0]], columns=["c1","c2","c3"])
    >>> description, plots = task_func(df)
    >>> print(description)
            c1    c2   c3
    count  3.0  3.00  3.0
    mean   4.0  3.50  6.0
    std    3.0  1.50  3.0
    min    1.0  2.00  3.0
    25%    2.5  2.75  4.5
    50%    4.0  3.50  6.0
    75%    5.5  4.25  7.5
    max    7.0  5.00  9.0
    """

instruct prompt

Describe a dataframe and draw a distribution chart for each numeric column after replacing the NaN values with the average of the column.
The function should output with:
    tuple: A tuple containing:
    DataFrame: A pandas DataFrame with statistics. This includes count, mean, standard deviation (std), min, 25%, 50%, 75%, and max values for each numeric column.
    List[Axes]: A list of matplotlib Axes objects representing the distribution plots for each numeric column.
    Each plot visualizes the distribution of data in the respective column with 10 bins.
You should write self-contained code starting with:

Code

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

code prompt

Code

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

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