Utilities to download and load data.
Utility class to get data from the Nordpil website.
Variables: | dir – The data destination directory. |
---|
Downloads the urbanareas file.
Returns: | The fully qualified path of the downloaded file. |
---|
Downloads and caches historical EOD data from the web. with the pandas.io.data.DataReader.
Retrieves EOD data from cache or the web.
Parameters: | ticker – The stock symbol, such as AAPL. |
---|---|
Returns: | The data as a pandas DataFrame. |
Utility class which downloads data from the SPAN Facebook webpage. :ivar fname: The path of the downloaded file.
Downloads the SPAN Facebook dataset.
Returns: | The fully qualified path of the downloaded file. |
---|
Utility class which downloads or loads weather data from the KNMI website.
Categorizes wind speed using the Beaufort scale. :param df: A pandas DataFrame.
Returns: | A categorized pandas DataFrame. |
---|
Categorize the wind direction (0 - 360) using cardinal direction (North, South etc.)
Parameters: | df – A pandas DataFrame. |
---|---|
Returns: | A categorized pandas DataFrame. |
Downloads, cleans and pickles weather data from the KNMI website.
Gets slightly longer and descriptive column labels.
Parameters: | alias – A short column name. |
---|---|
Returns: | A longer column name. |
Gets the column labels for the pandas DataFrame stored in the internal pickle.
Returns: | A list that contains the column names. |
---|
Loads data from an internal pickle.
Returns: | The pandas DataFrame loaded from the pickle. |
---|
Loads rain values without NA values as a NumPy array.
Returns: | The rain values as a NumPy array. |
---|
Caching proxy for the pandas Worldbank API.
Variables: |
|
---|
Caches the pandas.io.wb.download() results.
Returns: | The result of the query from cache or the WWW. |
---|
Gets an internal alias for the official Worldbank indicator.
Parameters: | name – The name of the Worldbank indicator. |
---|---|
Returns: | The internal alias. |
Caches the pandas.io.wb.get_countries() results.
Returns: | The result of the query from cache or the WWW. |
---|
Gets a longer descriptive name for a Worldbank indicator.
Parameters: | name – The name of a Worldbank indicator. |
---|---|
Returns: | The long descriptive name. |
Gets the official Worldbank indicator for an internal alias.
Parameters: | alias – The internal alias. |
---|---|
Returns: | The name of the Worldbank indicator. |
Renames the columns of a pandas DataFrame.
Parameters: |
|
---|---|
Returns: | The pandas DataFrame with its columns renamed. |
Converts a string representing money to the corresponding number in cents.
Parameters: |
|
---|---|
Returns: | Cents as an integer, for instance 1055. |
>>> from dautil import data
>>> data.centify('10.55')
1055
Download a file from the web.
Parameters: |
|
---|
Removes np.inf and np.nan values.
Parameters: | arr – Array with numbers. |
---|---|
Returns: | The cleaned array. |
>>> from dautil import data
>>> import numpy as np
>>> arr = np.array([np.inf, 0, 42, np.nan])
>>> data.dropinf(arr)
array([ 0., 42.])
Loads object from pickle.
Parameters: | fname – The name of the pickle file. |
---|---|
Returns: | The object from the pickle. |
Finds the appropriate data directory to store data files.
Returns: | A data directory, which is OS dependent. |
---|
Retrieves a CSV file with direct marketing data as described in http://blog.minethatdata.com/2008/03/ minethatdata-e-mail-analytics-and-data.html
Returns: | The path to the downloaded file. |
---|
Retrieves a WAV file of Austin Powers.
Returns: | The path to the downloaded file. |
---|
Downloads and uncompresses a GZIP file.
Parameters: |
|
---|
Downloads and uncompresses a ZIP file.
Parameters: |
|
---|---|
Returns: | The contents of the extracted file. |
Reads a CSV file and returns a list of dictionaries where each line corresponds to a line in the file.
Parameters: | fname – The name or path of the file. |
---|---|
Returns: | The dictionary. |