benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf f03322cc-6c16-5c51-8886-95ab17660436

Problem

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

complete prompt

import math
from random import randint
import pandas as pd


def task_func(cities_list):
    """
    Generate a DataFrame with population data for a list of cities. The population is generated randomly 
    and rounded up to the next thousand.
    
    Requirements:
    - pandas
    - math
    - random

    Parameters:
    cities_list (list): A list of city names.
    
    Returns:
    DataFrame: A pandas DataFrame with columns 'City' and 'Population', containing population data for the cities.

    Example:
    >>> cities = ['New York', 'London', 'Beijing', 'Tokyo', 'Sydney']
    >>> pop_data = task_func(cities)
    >>> type(pop_data)
    <class 'pandas.core.frame.DataFrame'>
    """

instruct prompt

Generate a DataFrame with population data for a list of cities. The population is generated randomly and rounded up to the next thousand.
The function should output with:
    DataFrame: A pandas DataFrame with columns 'City' and 'Population', containing population data for the cities.
You should write self-contained code starting with:

Code

import math
from random import randint
import pandas as pd
def task_func(cities_list):

code prompt

Code

import math
from random import randint
import pandas as pd
def task_func(cities_list):

entry point

task_func

libs

  • math
  • pandas
  • random

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