benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 01444319-d5b7-52b3-9864-f138d2406338

Problem

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

complete prompt

from collections import Counter
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns


def task_func(list_of_menuitems):
    """
    Given a nested list of menu items, this function flattens the list and visualizes the frequency
    of each menu item using a seaborn barplot.

    Parameters:
        list_of_menuitems (list): A nested list of menu items.

    Returns:
        matplotlib.axes.Axes: An Axes object representing the visualization, or None if there are no items to plot.

    Requirements:
        - collections
        - seaborn
        - pandas
        - matplotlib

    Example:
        >>> ax = task_func([['Pizza', 'Burger'], ['Pizza', 'Coke'], ['Pasta', 'Coke']])
        >>> isinstance(ax, matplotlib.axes.Axes)
        True
    """

instruct prompt

Given a nested list of menu items, this function flattens the list and visualizes the frequency of each menu item using a seaborn barplot.
The function should output with:
    matplotlib.axes.Axes: An Axes object representing the visualization, or None if there are no items to plot.
You should write self-contained code starting with:

Code

from collections import Counter
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
def task_func(list_of_menuitems):

code prompt

Code

from collections import Counter
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
def task_func(list_of_menuitems):

entry point

task_func

libs

  • pandas
  • collections
  • matplotlib
  • seaborn

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