benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 9b099199-f618-5bf7-9e4e-ddcc92a336cc

Problem

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

complete prompt

import pandas as pd
from itertools import combinations

# Constants
MIN_PERCENTAGE = 0.75

def task_func(data, cols, percentage):
    """
    Find all combinations of columns from a given DataFrame so that the absolute correlation between them is greater than a certain threshold.

    Parameters:
    - data (list): List of lists with the data, where the length of the inner list equals the number of columns
    - cols (list): List of column names
    - percentage (float): The threshold for the absolute correlation.

    Returns:
    - corr_combinations (list): A list of tuples where each tuple contains two column names.

    Requirements:
    - pandas
    - itertools

    Example:
    >>> result = task_func([[5.1, 5.0, 1.4], [4.9, 4.8, 1.4], [4.7, 4.6, 2.0]], ['x', 'y', 'z'], 0.9)
    >>> print(result)
    [('x', 'y')]
    """

instruct prompt

Find all combinations of columns from a given DataFrame so that the absolute correlation between them is greater than a certain threshold.
The function should output with:
    corr_combinations (list): A list of tuples where each tuple contains two column names.
You should write self-contained code starting with:

Code

import pandas as pd
from itertools import combinations
# Constants
MIN_PERCENTAGE = 0.75
def task_func(data, cols, percentage):

code prompt

Code

import pandas as pd
from itertools import combinations
# Constants
MIN_PERCENTAGE = 0.75
def task_func(data, cols, percentage):

entry point

task_func

libs

  • pandas
  • itertools

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