benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 27995700-3f7f-58ba-8195-36bf0e71d531

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):
    """
    Combine a list of dictionaries with the same keys into a single dictionary, turn it into a
    Pandas DataFrame and create a line plot of the data.

    Parameters:
    data (list): A list of dictionaries. The keys are labels and the values are data points.

    Returns:
    matplotlib.axes._axes.Axes or None: Axes object of the plot showing 'Data over Time',
                                                   with 'Time' on the x-axis and 'Data Points' on the y-axis.
                                                   If data is empty, return None.

    Requirements:
    - pandas
    - matplotlib.pyplot

    Example:
    >>> ax = task_func([{'A': 10, 'B': 15, 'C': 12},\
                    {'A': 12, 'B': 20, 'C': 14},\
                    {'A': 15, 'B': 18, 'C': 15},\
                    {'A': 11, 'B': 17, 'C': 13}])
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>
    >>> ax.get_title()
    'Data over Time'
    >>> len(ax.lines)
    3
    """

instruct prompt

Combine a list of dictionaries with the same keys into a single dictionary, turn it into a Pandas DataFrame and create a line plot of the data.
The function should output with:
    matplotlib.axes._axes.Axes or None: Axes object of the plot showing 'Data over Time',
    with 'Time' on the x-axis and 'Data Points' on the y-axis.
    If data is empty, return None.
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