benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 1409f23a-b52e-5896-82c3-72fffefa1983

Problem

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

complete prompt

import seaborn as sns
from random import sample


# Constants
COLUMNS = ['A', 'B', 'C', 'D', 'E']

def task_func(df, tuples, n_plots):
    """
    Remove rows from a dataframe based on values of multiple columns, and then create n random pairs of two columns 
    against each other to generate pairplots.

    Parameters:
    df (DataFrame): The pandas DataFrame.
    tuples (list of tuple): A list of tuples, where each tuple represents a row to be removed based on its values.
    n_plots (int): The number of pairplots to be generated using randomly selected column pairs.

    Returns:
    tuple: A tuple containing:
        - DataFrame: The modified DataFrame after removing specified rows.
        - list of Axes: A list containing the generated pairplots.

    Requirements:
    - seaborn
    - random

    Example:
    >>> import numpy as np, pandas as pd
    >>> df = pd.DataFrame(np.random.randint(0,100,size=(100, 5)), columns=list('ABCDE'))
    >>> tuples = [(10, 20, 30, 40, 50), (60, 70, 80, 90, 100)]
    >>> modified_df, plots = task_func(df, tuples, 3)
    """

instruct prompt

Remove rows from a dataframe based on values of multiple columns, and then create n random pairs of two columns against each other to generate pairplots.
The function should output with:
    tuple: A tuple containing:
    DataFrame: The modified DataFrame after removing specified rows.
    list of Axes: A list containing the generated pairplots.
You should write self-contained code starting with:

Code

import seaborn as sns
from random import sample
# Constants
COLUMNS = ['A', 'B', 'C', 'D', 'E']
def task_func(df, tuples, n_plots):

code prompt

Code

import seaborn as sns
from random import sample
# Constants
COLUMNS = ['A', 'B', 'C', 'D', 'E']
def task_func(df, tuples, n_plots):

entry point

task_func

libs

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