benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf e7255958-edf4-50fa-9e79-93530fbdb38d

Problem

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

complete prompt

import base64
import pandas as pd


def task_func(df):
    """
    Encodes a dict of list as a Base64 string. The dict is first converted to a Pandas DataFrame.
    Then convert the data franme to CSV format and encoded to bytes, finally encoded it to a Base64 string.

    Parameters:
        df (dict of list): A dictionary where the key 'Word' maps to a list of strings.

    Returns:
        str: The Base64 encoded string of the DataFrame's CSV representation.

    Requirements:
        - base64
        - pandas

    Example:
        >>> df = {'A': [1, 2, 3], 'B': [4, 5, 6]}
        >>> encoded_df = task_func(df)
        >>> isinstance(encoded_df, str)
        True
        >>> len(encoded_df) > 0  # The actual encoded string will vary
        True
    """

instruct prompt

Encodes a dict of list as a Base64 string. The dict is first converted to a Pandas DataFrame. Then convert the data franme to CSV format and encoded to bytes, finally encoded it to a Base64 string.
The function should output with:
    str: The Base64 encoded string of the DataFrame's CSV representation.
You should write self-contained code starting with:

Code

import base64
import pandas as pd
def task_func(df):

code prompt

Code

import base64
import pandas as pd
def task_func(df):

entry point

task_func

libs

  • pandas
  • base64

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