benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 420c32a8-ed05-5fd7-9cf9-aeaade240a20

Problem

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

complete prompt

import pandas as pd
import os

def task_func(filename):
    """
    Read a CSV file of pandas, reverse the order of the lines and write the inverted lines back into the file. Then move the cursor back to the beginning of the file. 
    The header should not be inverted and the file may be empty.

    Parameters:
    - filename (str): The name of the CSV file.

    Returns:
    - filename (str): The name of the CSV file.

    Requirements:
    - os
    - pandas

    Example:
    >>> task_func('file.csv')
    'file.csv'
    """

instruct prompt

Read a CSV file of pandas, reverse the order of the lines and write the inverted lines back into the file. Then move the cursor back to the beginning of the file. The header should not be inverted and the file may be empty.
The function should output with:
    filename (str): The name of the CSV file.
You should write self-contained code starting with:

Code

import pandas as pd
import os
def task_func(filename):

code prompt

Code

import pandas as pd
import os
def task_func(filename):

entry point

task_func

libs

  • pandas
  • 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