Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/statsmodels/datasets/fertility/data.py : 73%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""World Bank Fertility Data."""
2from statsmodels.datasets import utils as du
4__docformat__ = 'restructuredtext'
6COPYRIGHT = """This data is distributed according to the World Bank terms of use. See SOURCE."""
7TITLE = """World Bank Fertility Data"""
8SOURCE = """
9This data has been acquired from
11The World Bank: Fertility rate, total (births per woman): World Development Indicators
13At the following URL: http://data.worldbank.org/indicator/SP.DYN.TFRT.IN
15The sources for these statistics are listed as
17(1) United Nations Population Division. World Population Prospects
18(2) United Nations Statistical Division. Population and Vital Statistics Repot (various years)
19(3) Census reports and other statistical publications from national statistical offices
20(4) Eurostat: Demographic Statistics
21(5) Secretariat of the Pacific Community: Statistics and Demography Programme
22(6) U.S. Census Bureau: International Database
24The World Bank Terms of Use can be found at the following URL
26http://go.worldbank.org/OJC02YMLA0
27"""
29DESCRSHORT = """Total fertility rate represents the number of children that would be born to a woman if she were to live to the end of her childbearing years and bear children in accordance with current age-specific fertility rates."""
31DESCRLONG = DESCRSHORT
33#suggested notes
34NOTE = """
35::
37 This is panel data in wide-format
39 Number of observations: 219
40 Number of variables: 58
41 Variable name definitions:
42 Country Name
43 Country Code
44 Indicator Name - The World Bank Series indicator
45 Indicator Code - The World Bank Series code
46 1960 - 2013 - The fertility rate for the given year
47"""
50def load(as_pandas=None):
51 """
52 Load the data and return a Dataset class instance.
54 Parameters
55 ----------
56 as_pandas : bool
57 Flag indicating whether to return pandas DataFrames and Series
58 or numpy recarrays and arrays. If True, returns pandas.
60 Returns
61 -------
62 Dataset instance:
63 See DATASET_PROPOSAL.txt for more information.
64 """
65 return du.as_numpy_dataset(load_pandas(), as_pandas=as_pandas)
68def load_pandas():
69 data = _get_data()
70 return du.Dataset(data=data)
73def _get_data():
74 return du.load_csv(__file__, 'fertility.csv')