benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 242fbce5-606a-5d93-a12b-8c5b3ac8933a

Problem

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

complete prompt

import pandas as pd
import re
import os

def task_func(dir_path: str, pattern: str = '^EMP'):
    """
    Look for all ascendingly sorted files in a directory that start with a given pattern, and return the number of files against their size. You should return a pandas DataFrame with 2 columns 'File' and 'Size' with correspond to the file name and the size respectively.

    Parameters:
    - dir_path (str): The path to the directory.
    - pattern (str): The pattern to match. Default is '^EMP' (files starting with 'EMP').

    Returns:
    - pandas.DataFrame: A pandas DataFrame with file names and their sizes.

    Requirements:
    - pandas
    - re
    - os

    Example:
    >>> report = task_func('/path/to/directory')
    >>> print(report)
    """

instruct prompt

Look for all ascendingly sorted files in a directory that start with a given pattern, and return the number of files against their size. You should return a pandas DataFrame with 2 columns 'File' and 'Size' with correspond to the file name and the size respectively.
The function should output with:
    pandas.DataFrame: A pandas DataFrame with file names and their sizes.
You should write self-contained code starting with:

Code

import pandas as pd
import re
import os
def task_func(dir_path: str, pattern: str = '^EMP'):

code prompt

Code

import pandas as pd
import re
import os
def task_func(dir_path: str, pattern: str = '^EMP'):

entry point

task_func

libs

  • pandas
  • re
  • os

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