benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 070d0f5f-16c9-5d83-ad2f-bdc1ea275b81

Problem

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

complete prompt

import pandas as pd
import numpy as np


def task_func(file_path="data.csv", columns=["A", "B", "C"]):
    """
    Read a CSV file into a Pandas DataFrame, convert numeric values into floats,and draw a line chart of data in the specified columns.
    In addition, compute the cube-root of the data.

    Parameters:
    - file_path (str): Path to the CSV file. Default is 'data.csv'.
    - columns (list of str): List of column names from the data to plot.
                             Default is ['A', 'B', 'C'].

    Returns:
    tuple: A tuple containing:
        - DataFrame: A pandas DataFrame of the data in the CSV file.
        - Axes: A matplotlib Axes object showing the plotted data.
        - Series: A pandas Series containing the cube-root of the data.

    Requirements:
    - pandas
    - numpy

    Example:
    >>> df, ax, croot = task_func('path_to_csv.csv', ['Column1', 'Column2', 'Column3'])
    >>> df
       Column1  Column2  Column3
    0      1.0      2.0      3.0
    1      4.0      5.0      6.0
    >>> ax
    <matplotlib.axes._axes.Axes object at 0x7f24b00f4a90>
    >>> croot
    0    1.0
    """

instruct prompt

Read a CSV file into a Pandas DataFrame, convert numeric values into floats,and draw a line chart of data in the specified columns. In addition, compute the cube-root of the data.
The function should output with:
    tuple: A tuple containing:
    DataFrame: A pandas DataFrame of the data in the CSV file.
    Axes: A matplotlib Axes object showing the plotted data.
    Series: A pandas Series containing the cube-root of the data.
You should write self-contained code starting with:

Code

import pandas as pd
import numpy as np
def task_func(file_path="data.csv", columns=["A", "B", "C"]):

code prompt

Code

import pandas as pd
import numpy as np
def task_func(file_path="data.csv", columns=["A", "B", "C"]):

entry point

task_func

libs

  • pandas
  • numpy

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