Skip to content

Weather

Make API calls to OpenWeatherMap to obtain a weather forecast of cities worldwide

forecast(latitudes, longitudes, api_key)

Get the weather forecast for the next 5 days for a list of cities

Parameters:

  • latitudes (list) –

    List of latitudes for which to get the weather forecast. Must be the same length as longitudes

  • longitudes (list) –

    List of longitudes for which to get the weather forecast. Must be the same length as latitudes

  • api_key (str) –

    OpenWeatherMap API key to access the weather data

Returns:

  • weather ( DataFrame ) –

    DataFrame containing the weather forecast for the next 5 days. The column 'id' is the index of the location in the input list

Raises:

  • ValueError

    If the length of latitudes and longitudes do not match

Warns:

Notes

The columns are 'id', 'forecast_time', 'outlook', 'temperature', 'feels_like', 'wind_speed', 'rain_prob', 'rain_in_last_3h', and 'weather_retrieved_at'. All timestamps are in UTC.