benchmarks.wiki / Public workspace

BigCodeBench / BigCodeBench v0.1.0_hf 9391fb7a-3663-5526-9ded-365b79e62f70

Problem

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

complete prompt

import pandas as pd
import numpy as np
import folium

def task_func(dic={'Lon': (-180, 180), 'Lat': (-90, 90)}, cities=['New York', 'London', 'Beijing', 'Tokyo', 'Sydney']):
    """
    Create a map with markers for a list of cities, where the coordinates are randomly generated within given ranges.

    Parameters:
    dic (dict): Dictionary with 'Lon' and 'Lat' keys, each a tuple (min, max) for coordinate range. 
                Default: {'Lon': (-180, 180), 'Lat': (-90, 90)}
    cities (list): List of city names. Default: ['New York', 'London', 'Beijing', 'Tokyo', 'Sydney']

    Returns:
    tuple: A tuple containing (folium.Map, pandas.DataFrame).
           The DataFrame contains 'City', 'Longitude', and 'Latitude' columns.

    Raises:
    ValueError: If 'Lon' or 'Lat' keys are missing in the dictionary, or if their values are not tuples.

    Requirements:
    - pandas
    - numpy
    - folium

    Example:
    >>> dic = {'Lon': (-180, 180), 'Lat': (-90, 90)}
    >>> map_obj, city_data = task_func(dic)
    """

instruct prompt

Create a map with markers for a list of cities, where the coordinates are randomly generated within given ranges.
The function should raise the exception for: ValueError: If 'Lon' or 'Lat' keys are missing in the dictionary, or if their values are not tuples.
The function should output with:
    tuple: A tuple containing (folium.Map, pandas.DataFrame).
    The DataFrame contains 'City', 'Longitude', and 'Latitude' columns.
You should write self-contained code starting with:

Code

import pandas as pd
import numpy as np
import folium
def task_func(dic={'Lon': (-180, 180), 'Lat': (-90, 90)}, cities=['New York', 'London', 'Beijing', 'Tokyo', 'Sydney']):

code prompt

Code

import pandas as pd
import numpy as np
import folium
def task_func(dic={'Lon': (-180, 180), 'Lat': (-90, 90)}, cities=['New York', 'London', 'Beijing', 'Tokyo', 'Sydney']):

entry point

task_func

libs

  • pandas
  • folium
  • numpy

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