{"kind":"task","effective_mode":"full","benchmark":{"kind":"benchmark","effective_mode":"full","slug":"bigcodebench","formal_name":"BigCodeBench","introduction":"BigCodeBench poses 1,140 function-level tasks drawn across 139 libraries. It tests whether a model can compose several real APIs correctly rather than write one self-contained function.","introduction_ja":"","introduction_en":"","category":"Category not supplied","task_count":null,"acquisition_status":"Acquisition status not supplied","official_url":"https://bigcode-bench.github.io/","indexing_mode":"index","profile":{"resources":[],"task_format":"","scoring":"","metric":"","size":"","answer_access":"","license":"","citation":"","maintainer":"","released":"","why_hard":"","related":[],"history":"","construction":"","limitations":"","saturation":"","scores":[]}},"task_id":"13fbe0d5-b6db-55da-a7ca-851c2bfae163","task_key":"default--v0~2e1~2e0~5fhf--13fbe0d5-b6db-55da-a7ca-851c2bfae163","task_revision_id":"1","upstream_id":"","short_description":"BigCodeBench v0.1.0_hf 13fbe0d5-b6db-55da-a7ca-851c2bfae163","config":"default","split":"v0.1.0_hf","body":"{\"code_prompt\":\"import pandas as pd\\nfrom sklearn.preprocessing import StandardScaler\\nfrom sklearn.decomposition import PCA\\ndef task_func(data, n_components=2):\\n\",\"complete_prompt\":\"import pandas as pd\\nfrom sklearn.preprocessing import StandardScaler\\nfrom sklearn.decomposition import PCA\\n\\ndef task_func(data, n_components=2):\\n    \\\"\\\"\\\"\\n    Perform PCA (Principal Component Analysis) on the provided DataFrame.\\n\\n    This function takes a pandas DataFrame, scales the data using sklearn \\n    StandardScaler, and then applies PCA to reduce \\n    the number of dimensions of the data to the number specified by n_components, \\n    maintaining as much information as possible.\\n\\n    Parameters:\\n    data (DataFrame): A pandas DataFrame containing numerical data. Each column represents a \\n                      different variable, and each row represents a different observation.\\n    n_components (int): The number of principal components to retain after transformation. \\n                        Default is 2.\\n\\n    Returns:\\n    DataFrame: A new DataFrame with the original data transformed into 'n_components' principal \\n               components.\\n\\n    Raises:\\n    ValueError: If input data is not a DataFrame or contains non-numeric data.\\n    ValueError: If n_components is greater than the number of columns in the data.\\n    ValueError: If input data is empty.\\n\\n    Requirements:\\n    pandas\\n    sklearn.preprocessing\\n    sklearn.decomposition\\n\\n    Example:\\n    >>> data = pd.DataFrame({\\n    ...     'A': [1, 2, 3, 4, 5],\\n    ...     'B': [6, 7, 8, 9, 10],\\n    ...     'C': [11, 12, 13, 14, 15],\\n    ...     'D': [16, 17, 18, 19, 20]\\n    ... })\\n    >>> result = task_func(data, n_components=2)\\n    >>> print(result)\\n              0             1\\n    0  2.828427  3.648565e-16\\n    1  1.414214 -1.216188e-16\\n    2 -0.000000  0.000000e+00\\n    3 -1.414214  1.216188e-16\\n    4 -2.828427  2.432377e-16\\n\\n    >>> data = pd.DataFrame({\\n    ...         'A': [-43, 212, 1, -12, 5],\\n    ...         'B': [-1, 0, 0, 9.76, 12.34],\\n    ...         'C': [1, 42, -13.2, 31, 1.23],\\n    ... })\\n    >>> res = task_func(data, n_components=1)\\n    >>> print(res)        \\n              0\\n    0 -0.793152\\n    1  2.511947\\n    2 -0.940253\\n    3  0.069179\\n    4 -0.847722\\n    \\\"\\\"\\\"\\n\",\"entry_point\":\"task_func\",\"instruct_prompt\":\"Perform PCA (Principal Component Analysis) on the provided DataFrame. This function takes a pandas DataFrame, scales the data using sklearn StandardScaler, and then applies PCA to reduce the number of dimensions of the data to the number specified by n_components, maintaining as much information as possible. >>> data = pd.DataFrame({ ...         'A': [-43, 212, 1, -12, 5], ...         'B': [-1, 0, 0, 9.76, 12.34], ...         'C': [1, 42, -13.2, 31, 1.23], ... }) >>> res = task_func(data, n_components=1) >>> print(res) 0 0 -0.793152 1  2.511947 2 -0.940253 3  0.069179 4 -0.847722\\nThe function should raise the exception for: ValueError: If input data is not a DataFrame or contains non-numeric data. ValueError: If n_components is greater than the number of columns in the data. ValueError: If input data is empty.\\nThe function should output with:\\n    DataFrame: A new DataFrame with the original data transformed into 'n_components' principal\\n    components.\\nYou should write self-contained code starting with:\\n```\\nimport pandas as pd\\nfrom sklearn.preprocessing import StandardScaler\\nfrom sklearn.decomposition import PCA\\ndef task_func(data, n_components=2):\\n```\",\"libs\":\"['pandas', 'sklearn']\"}","display_format":"code","language":"","answer_status":"published","assets":[],"source_url":"https://bigcode-bench.github.io/","history":"initial import","indexing_mode":"index","subproblems":[],"grids":[]}