benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf d3aef295-6f31-58df-87bb-0817e148737a

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(d, keys=['x', 'y', 'z']):
    """
    Plot values from a list of dictionaries based on specified keys and return the plot as a Matplotlib Axes object.
    
    Parameters:
    d (list): A list of dictionaries containing numerical data.
    keys (list, optional): A list of string keys to plot. Defaults to ['x', 'y', 'z'].

    Returns:
    Matplotlib Axes object: The plot showing the values of specified keys from the input list of dictionaries.

    Requirements:
    - pandas
    - matplotlib.pyplot

    Example:
    >>> data = [{'x': 1, 'y': 10, 'z': 5}, {'x': 3, 'y': 15, 'z': 6}, {'x': 2, 'y': 1, 'z': 7}]
    >>> ax = task_func(data)
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>

    >>> ax = task_func(data, keys=['x', 'y'])
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>
    """

instruct prompt

Plot values from a list of dictionaries based on specified keys and return the plot as a Matplotlib Axes object. >>> ax = task_func(data, keys=['x', 'y']) >>> type(ax) <class 'matplotlib.axes._axes.Axes'>
The function should output with:
    Matplotlib Axes object: The plot showing the values of specified keys from the input list of dictionaries.
You should write self-contained code starting with:

Code

import pandas as pd
import matplotlib.pyplot as plt
def task_func(d, keys=['x', 'y', 'z']):

code prompt

Code

import pandas as pd
import matplotlib.pyplot as plt
def task_func(d, keys=['x', 'y', 'z']):

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