Hide keyboard shortcuts

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 

3 

4__docformat__ = 'restructuredtext' 

5 

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 

10 

11The World Bank: Fertility rate, total (births per woman): World Development Indicators 

12 

13At the following URL: http://data.worldbank.org/indicator/SP.DYN.TFRT.IN 

14 

15The sources for these statistics are listed as 

16 

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 

23 

24The World Bank Terms of Use can be found at the following URL 

25 

26http://go.worldbank.org/OJC02YMLA0 

27""" 

28 

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.""" 

30 

31DESCRLONG = DESCRSHORT 

32 

33#suggested notes 

34NOTE = """ 

35:: 

36 

37 This is panel data in wide-format 

38 

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""" 

48 

49 

50def load(as_pandas=None): 

51 """ 

52 Load the data and return a Dataset class instance. 

53 

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. 

59 

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) 

66 

67 

68def load_pandas(): 

69 data = _get_data() 

70 return du.Dataset(data=data) 

71 

72 

73def _get_data(): 

74 return du.load_csv(__file__, 'fertility.csv')