benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf c29a5cf2-2bdf-501e-9aca-e91976ea1c18

Problem

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

complete prompt

import sqlite3
import pandas as pd
import os


def task_func(db_name, table_name, csv_path="data.csv"):
    """
    Read SQLite3 table via pandas and export to a CSV file.

    Parameters:
    - db_name (str): The path to the SQLite3 database.
    - table_name (str): The name of the table to export.
    - csv_path (str, optional): The path where the CSV file will be saved. Defaults to 'data.csv'.

    Requirements:
    - sqlite3
    - pandas
    - os

    Returns:
    str: The absolute path of the exported CSV file.

    Example:
    >>> task_func('test.db', 'People')
    'data.csv'
    >>> task_func('/absolute/path/to/test.db', 'Orders', 'orders.csv')
    '/absolute/path/to/orders.csv'
    """

instruct prompt

Read SQLite3 table via pandas and export to a CSV file.
The function should output with:
    str: The absolute path of the exported CSV file.
You should write self-contained code starting with:

Code

import sqlite3
import pandas as pd
import os
def task_func(db_name, table_name, csv_path="data.csv"):

code prompt

Code

import sqlite3
import pandas as pd
import os
def task_func(db_name, table_name, csv_path="data.csv"):

entry point

task_func

libs

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