Skip to main content

A Python library which acts as a wrapper for the WorldWeatherOnline API.

Project description

WorldWeatherPy

A Python library for the retrieval of historical weather data.

This library scrapes WorldWeatherOnline.com to collect historical weather data, returning a Pandas DataFrame. The DetermineListOfAttributes class returns all weather attributes available for retrieval through the WorldWeatherOnline.com API, whilst the HistoricalLocationWeather class retrieves an array of typically required weather attributes. The RetrieveByAttribute class can be used to request specific weather attributes, or a list of specific weather attributes, as available through the DetermineListOfAttributes class.

Installation

From Python:

pip install WorldWeatherPy
from WorldWeatherPy import DetermineListOfAttributes
from WorldWeatherPy import HistoricalLocationWeather
from WorldWeatherPy import RetrieveByAttribute

Usage

If you are unsure of the available weather attributes:

pip install WorldWeatherPy
from WorldWeatherPy import DetermineListOfAttributes
attributes = DetermineListOfAttributes(api_key, True).retrieve_list_of_options()

Returns a list containing all available weather attributes. If 'verbose' is set to True, this will be printed within the function call.

If you would like to retrieve standard weather attributes:

pip install WorldWeatherPy
from WorldWeatherPy import HistoricalLocationWeather
dataset = HistoricalLocationWeather(api_key, city, start_date, end_date, frequency).retrieve_hist_data()

Returns a Pandas DataFrame 'dataset', which contains an array of weather attributes for the given city, between the start and end dates specified, with hourly frequency, indexed by date and time.

If you would like to retrieve specific weather attributes:

pip install WorldWeatherPy
from WorldWeatherPy import RetrieveByAttribute
dataset = RetrieveByAttribute(api_key, attribute_list, city, start_date, end_date, frequency).retrieve_hist_data()

Returns a Pandas DataFrame 'dataset', which contains a list of pre-specified weather attributes for the given city, between the start and end dates specified, with hourly frequency, indexed by date and time.

Input Arguments

Argument Description
api_key the API key obtained from https://www.worldweatheronline.com/developer/. (str)
attribute_list a list of weather attributes to collect. (list)
city a city for which to retrieve data. (str).
start_date a string in the format YYYY-MM-DD (str).
end_date a string in the format YYYY-MM-DD (str).
frequency the frequency of extracted data, measured in hours. (int)
verbose boolean determining printing during data extraction. (bool) [Default = True]
csv_directory an optional file directory to store the output. (os directory) [Default = None]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WorldWeatherPy-0.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

WorldWeatherPy-0.0.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file WorldWeatherPy-0.0.1.tar.gz.

File metadata

  • Download URL: WorldWeatherPy-0.0.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for WorldWeatherPy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8b3356bd5002ae9bfab902cd865919796f708c12a4dc42bf3ab6c14b24a06e7e
MD5 893f1a68abcb9b47da9e46bc492db5e6
BLAKE2b-256 b11bf59e64fcae0dc74a7a57c62d9b9df62d916208f305f51e6546ca0d8260c8

See more details on using hashes here.

File details

Details for the file WorldWeatherPy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: WorldWeatherPy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for WorldWeatherPy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 926e0e0d086fedfcaaa1cf8f7120531ebb16dd7d06f53df3b6d092ee521f9bf5
MD5 f90f2a27cfe8e66aed5ae6418e3a233b
BLAKE2b-256 b8cb554830e42b9ddc0e65c46bec63e4ee4de8825649dfea3b0b511c44aeb454

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page