benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf d98b11c5-eec9-5a8f-b1f3-765f381e1c10

Problem

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

complete prompt

import pandas as pd
import matplotlib.pyplot as plt

def task_func(data):
    """
    Draw a pie chart that shows the job distribution in the given data and return the plot object.

    Parameters:
    data (DataFrame): A pandas DataFrame where each row represents an individual's data, 
                      with columns 'Name' (str), 'Date' (str in format 'dd/mm/yyyy'), and 'Job' (str).

    Returns:
    matplotlib.figure.Figure: The Figure object containing the pie chart.

    Raises:
    - The function will raise ValueError if the input data is not a DataFrame.

    Requirements:
    - matplotlib.pyplot
    - pandas

    Example:
    >>> data = pd.DataFrame({'Name': ['John', 'Jane', 'Joe'],
    ...                      'Date': ['01/03/2012', '02/05/2013', '03/08/2014'],
    ...                      'Job': ['Engineer', 'Doctor', 'Lawyer']})
    >>> fig = task_func(data)
    >>> type(fig)
    <class 'matplotlib.figure.Figure'>
    >>> len(fig.axes[0].patches) #check slices from pie chart
    3
    >>> plt.close()
    """

instruct prompt

Draw a pie chart that shows the job distribution in the given data and return the plot object.
The function should raise the exception for: The function will raise ValueError if the input data is not a DataFrame.
The function should output with:
    matplotlib.figure.Figure: The Figure object containing the pie chart.
You should write self-contained code starting with:

Code

import pandas as pd
import matplotlib.pyplot as plt
def task_func(data):

code prompt

Code

import pandas as pd
import matplotlib.pyplot as plt
def task_func(data):

entry point

task_func

libs

  • pandas
  • matplotlib

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