benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf c6ff3a02-24d9-5576-8605-a3b3ec0b958f

Problem

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

complete prompt

import numpy as np
import pandas as pd
from dateutil.parser import parse



def task_func(dates_str_list):
    """
    Analyze the weekday distribution in a list of date strings. Implemented by dateutil.parser.

    This function takes a list of date strings in "yyyy-mm-dd" format, calculates 
    the weekday for each date, and returns a distribution of the weekdays.

    Parameters:
    - dates_str_list (list): The list of date strings in "yyyy-mm-dd" format.

    Returns:
    - Series: A pandas Series of the weekday distribution, where the index represents 
              the weekdays (from Monday to Sunday) and the values represent the counts 
              of each weekday in the provided list.

    Requirements:
    - datetime
    - dateutil.parser
    - numpy
    - pandas

    Example:
    >>> task_func(['2022-10-22', '2022-10-23', '2022-10-24', '2022-10-25'])
    Monday       1
    Tuesday      1
    Wednesday    0
    Thursday     0
    Friday       0
    Saturday     1
    Sunday       1
    dtype: int64
    """

instruct prompt

Analyze the weekday distribution in a list of date strings. Implemented by dateutil.parser. This function takes a list of date strings in "yyyy-mm-dd" format, calculates the weekday for each date, and returns a distribution of the weekdays.
The function should output with:
    Series: A pandas Series of the weekday distribution, where the index represents
    the weekdays (from Monday to Sunday) and the values represent the counts
    of each weekday in the provided list.
You should write self-contained code starting with:

Code

import numpy as np
import pandas as pd
from dateutil.parser import parse
def task_func(dates_str_list):

code prompt

Code

import numpy as np
import pandas as pd
from dateutil.parser import parse
def task_func(dates_str_list):

entry point

task_func

libs

  • dateutil
  • pandas
  • numpy

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