benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 0b5be739-85bc-5892-ba43-031ebce89872

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(data, column="c"):
    """
    Remove a column from a data dictionary if it exists, and then plot the remaining data
    if it contains numeric data.

    Parameters:
    - data (dict): The input data dictionary.
    - column (str): Name of column to remove. Defaults to "c".

    Returns:
    - df (pd.DataFrame): The modified DataFrame after removing the specified column.
    - ax (matplotlib.axes._axes.Axes or None): The plot of the modified DataFrame if there's
      numeric data to plot, otherwise None.

    Requirements:
    - pandas
    - numpy

    Example:
    >>> data = {'a': [1, 2, 3], 'b': [4, 5, 6], 'c': [7, 8, 9]}
    >>> modified_df, ax = task_func(data)
    >>> ax
    <Axes: >
    >>> modified_df
       a  b
    0  1  4
    1  2  5
    2  3  6
    """

instruct prompt

Remove a column from a data dictionary if it exists, and then plot the remaining data if it contains numeric data.
The function should output with:
    df (pd.DataFrame): The modified DataFrame after removing the specified column.
    ax (matplotlib.axes._axes.Axes or None): The plot of the modified DataFrame if there's
    numeric data to plot, otherwise None.
You should write self-contained code starting with:

Code

import pandas as pd
import numpy as np
def task_func(data, column="c"):

code prompt

Code

import pandas as pd
import numpy as np
def task_func(data, column="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