benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf cfdfc759-1547-5e11-9b44-c688932b5815

Problem

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

complete prompt

import matplotlib.pyplot as plt
import pandas as pd

def task_func(temperatures):
    """
    Calculate and plot the daytime temperatures for New York over a given period. The plot uses Arial font for display.

    Parameters:
        temperatures (pandas.DataFrame): The temperatures data as a pandas DataFrame with a DateTimeIndex 
                                         in the 'America/New_York' timezone and a 'temperature' column.

    Returns:
        matplotlib.axes.Axes: The Axes object containing the temperature plot.
        
    for the returned plot,  set the xlabel as 'Date', ylabel as 'Temperature (°C)' and
    title as Daily Temperatures in New York

    Raises:
        ValueError: If the input DataFrame is not in the expected format or empty.

    Requirements:
        - matplotlib
        - pandas

    Example:
        >>> temperatures = pd.DataFrame({
        ...     'temperature': [random.randint(-10, 30) for _ in range(365)],
        ...     'date': pd.date_range(start='01-01-2023', periods=365, tz='America/New_York')
        ... }).set_index('date')
        >>> ax = task_func(temperatures)
        >>> type(ax)
        <class 'matplotlib.axes._axes.Axes'>
    """

instruct prompt

Calculate and plot the daytime temperatures for New York over a given period. The plot uses Arial font for display. for the returned plot,  set the xlabel as 'Date', ylabel as 'Temperature (°C)' and title as Daily Temperatures in New York
The function should raise the exception for: ValueError: If the input DataFrame is not in the expected format or empty.
The function should output with:
    matplotlib.axes.Axes: The Axes object containing the temperature plot.
You should write self-contained code starting with:

Code

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

code prompt

Code

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

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