benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 625072ff-23a6-5149-9179-f732f75d0ecf

Problem

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

complete prompt

from datetime import datetime, timedelta
import pytz
import numpy as np
import matplotlib.pyplot as plt


def task_func(start_time, end_time):
    """
    Plots the hourly difference between UTC and specified global time zones across a date range.

    This function visualizes the time difference in hours between UTC and predefined time zones for each day
    within the specified date range. Predefined time zones include UTC, America/Los_Angeles, Europe/Paris,
    Asia/Kolkata, and Australia/Sydney. The differences are plotted on a graph, using a distinct color for
    each time zone's time difference curve, selecting from ["b", "g", "r", "c", "m", "y", "k"].

    Parameters:
    - start_time (str): The start date in the format "yyyy-mm-dd".
    - end_time (str): The end date in the format "yyyy-mm-dd".

    Returns:
    - matplotlib.axes.Axes: The Axes object with the plotted time differences in hours between UTC and 
                            other time zones.

    Requirements:
    - datetime.datetime
    - datetime.timedelta
    - pytz
    - numpy
    - matplotlib.pyplot

    Example:
    >>> ax = task_func('2021-01-01', '2021-01-10')
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>
    >>> ax.get_xticklabels()
    [Text(18628.0, 0, '2021-01-01'), Text(18629.0, 0, '2021-01-02'), Text(18630.0, 0, '2021-01-03'), Text(18631.0, 0, '2021-01-04'), Text(18632.0, 0, '2021-01-05'), Text(18633.0, 0, '2021-01-06'), Text(18634.0, 0, '2021-01-07'), Text(18635.0, 0, '2021-01-08'), Text(18636.0, 0, '2021-01-09')]
    """

instruct prompt

Plots the hourly difference between UTC and specified global time zones across a date range. This function visualizes the time difference in hours between UTC and predefined time zones for each day within the specified date range. Predefined time zones include UTC, America/Los_Angeles, Europe/Paris, Asia/Kolkata, and Australia/Sydney. The differences are plotted on a graph, using a distinct color for each time zone's time difference curve, selecting from ["b", "g", "r", "c", "m", "y", "k"].
The function should output with:
    matplotlib.axes.Axes: The Axes object with the plotted time differences in hours between UTC and
    other time zones.
You should write self-contained code starting with:

Code

from datetime import datetime, timedelta
import pytz
import numpy as np
import matplotlib.pyplot as plt
def task_func(start_time, end_time):

code prompt

Code

from datetime import datetime, timedelta
import pytz
import numpy as np
import matplotlib.pyplot as plt
def task_func(start_time, end_time):

entry point

task_func

libs

  • pytz
  • datetime
  • numpy
  • 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