Skip to content

Stellenbosch-Econometrics/SAMADB-Issues

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 

Repository files navigation

South Africa Macroeconomic Database

CRAN status cran checks downloads per month downloads pypi versions PyPI - Downloads SAMaDB

The South Africa Macroeconomic Database (SAMADB) is an open relational database with ~10,000 macroeconomic time series for South Africa, obtained from the South African Reserve Bank (SARB) and Statistics South Africa (STATSSA) and updated on a weekly basis via EconData and automated scraping of the SARB and STATSSA websites. It is accessible through API packages for R, Python and Julia. While the source code for SAMADB and the APIs remains private, this public repo provides guidance on API installation and allows you to report issues with the database or APIs. Each API has its own built-in documentation. More information about SAMADB is available in the introductory presentation.

SAMADB Installation and Usage

R API

To install from CRAN, use

install.packages("samadb")

Then attach the package with

library(samadb)
help("samadb") # Open Documentation 

Notes: The R API offers the broadest functionality, including the possibility to transpose data and export data to Excel. In the wide format, variable labels are attached to the series as attributes, and can be received using collapse::vlabels() or, together with names, using collapse::namlab(). Functions return a data.table.


Python API

To install from pypi, open a terminal and execute

pip install samadb

Then import the package with

import samadb as sm
help(sm) # Overview of Package Functions

Notes: The python package returns polars DataFrame's. These can be converted to pandas DataFrame's using the .to_pandas() method. The Python API is a bit different than the R API, due to the greater difficulty of dealing with variable labels in Python. It also presently has no options to transpose or export to Excel, which can however be achieved by converting to pandas and using the .to_excel() method.


Julia API

To install from the Julia package registry, use

using Pkg; Pkg.add("SAMaDB")

Then import the package with

import SAMaDB as sm
?sm # Overview of Package Functions

Notes: The Julia API returns DataFrame's, and is pretty much identical to the Python API i.e. you should access functions using qualified names as in Python, e.g. sm.datasets(). No functions are exported.

About

South Africa Macroeconomic Database (SAMADB): Report issues with the database or APIs for R, Python and Julia

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published