benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 790d25cf-859b-5885-b2da-929d99d33ac3

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 seaborn as sns


def task_func(db_name="test.db", table_name="People"):
    """
    Draw the age distribution of the persons in an SQLite3 table and returns the Axes object of the plot.
    Raises a ValueError if the loaded data contains negative age values.

    Parameters:
    db_name (str, optional): The full path to the SQLite3 database file. Defaults to 'test.db'.
    table_name (str, optional): The name of the table to plot from. Defaults to 'People'.

    Returns:
    matplotlib.axes._axes.Axes: Axes object representing the age distribution plot,
                                           with x-axis showing 'age' and a default of bins of 30, and kde set to True.

    Requirements:
    - sqlite3
    - pandas
    - seaborn

    Raises:
    ValueError: If the data contains negative age values.
    
    Examples:
    >>> ax = task_func('path/to/test.db', 'People')
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>
    >>> ax = task_func()
    >>> type(ax)
    <class 'matplotlib.axes._axes.Axes'>
    """

instruct prompt

Draw the age distribution of the persons in an SQLite3 table and returns the Axes object of the plot. Raises a ValueError if the loaded data contains negative age values.
The function should raise the exception for: ValueError: If the data contains negative age values.
The function should output with:
    matplotlib.axes._axes.Axes: Axes object representing the age distribution plot,
    with x-axis showing 'age' and a default of bins of 30, and kde set to True.
You should write self-contained code starting with:

Code

import sqlite3
import pandas as pd
import seaborn as sns
def task_func(db_name="test.db", table_name="People"):

code prompt

Code

import sqlite3
import pandas as pd
import seaborn as sns
def task_func(db_name="test.db", table_name="People"):

entry point

task_func

libs

  • sqlite3
  • pandas
  • seaborn

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