benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf d7d1ce5a-6fe4-5dc5-bbdf-79fc4712b253

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
import seaborn as sns


def task_func(num_samples=100, num_features=5):
    """
    Generate a Pandas DataFrame with random values, representing a dataset with multiple features. 
    Calculate the correlation between the features and visualize this information using a heatmap.
    
    Parameters:
    - num_samples (int): The number of samples to generate. Default is 100.
    - num_features (int): The number of features to generate. Default is 5.
    
    Returns:
    - DataFrame: The generated DataFrame with random values.
    - Axes: The heatmap visualization of the correlation matrix.

    Requirements:
    - pandas
    - numpy
    - seaborn
    
    Example:
    >>> df, ax = task_func(10, 3)
    >>> ax.figure.show()
    """

instruct prompt

Generate a Pandas DataFrame with random values, representing a dataset with multiple features. Calculate the correlation between the features and visualize this information using a heatmap.
The function should output with:
    DataFrame: The generated DataFrame with random values.
    Axes: The heatmap visualization of the correlation matrix.
You should write self-contained code starting with:

Code

import numpy as np
import pandas as pd
import seaborn as sns
def task_func(num_samples=100, num_features=5):

code prompt

Code

import numpy as np
import pandas as pd
import seaborn as sns
def task_func(num_samples=100, num_features=5):

entry point

task_func

libs

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