benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 0221d418-5b32-5159-aeea-ceea1710b5ad

Problem

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

complete prompt

import pandas as pd
from statsmodels.tsa.stattools import adfuller


def task_func(df: pd.DataFrame, column_a: str, column_b: str, column_c: str) -> bool:
    """
    Determines if a specific subset of data is stationary by filtering rows where column_b bigger than 50 and column_c equal to 900. 
    Data is considered to be stationary if the p_value returned by the Augmented Dickey-Fuller test is smaller than 0.05.

    If column_a is empty after filtering or if its values are constant, True
    is returned.
    
    Parameters:
        df (pd.DataFrame): A DataFrame containing the data.
        column_a (str): The name of the column to test for stationarity.
        column_b (str): The name of the column used for filtering based on its value being greater than 50.
        column_c (str): The name of the column used for filtering based on its value being equal to 900.
    
    Returns:
        bool: True if the data in column_a (after filtering based on column_b and column_c) is stationary, False otherwise.
    
    Requirements:
        pandas
        statsmodels: for using the adfuller test

    Example:
    >>> df = pd.DataFrame({
    ...      'A': [1, 2, 3, 4, 5, 6],
    ...      'B': [60, 70, 80, 90, 100, 110],
    ...      'C': [900, 900, 900, 900, 900, 900]
    ... })
    >>> task_func(df, 'A', 'B', 'C')
    False
    """

instruct prompt

Determines if a specific subset of data is stationary by filtering rows where column_b bigger than 50 and column_c equal to 900. Data is considered to be stationary if the p_value returned by the Augmented Dickey-Fuller test is smaller than 0.05. If column_a is empty after filtering or if its values are constant, True is returned.
The function should output with:
    bool: True if the data in column_a (after filtering based on column_b and column_c) is stationary, False otherwise.
You should write self-contained code starting with:

Code

import pandas as pd
from statsmodels.tsa.stattools import adfuller
def task_func(df: pd.DataFrame, column_a: str, column_b: str, column_c: str) -> bool:

code prompt

Code

import pandas as pd
from statsmodels.tsa.stattools import adfuller
def task_func(df: pd.DataFrame, column_a: str, column_b: str, column_c: str) -> bool:

entry point

task_func

libs

  • pandas
  • statsmodels

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