LSMS_Library 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,7 +12,7 @@ people_last7days:
12
12
  Girls : h14q4
13
13
 
14
14
  cluster_features:
15
- file: ../Data/GSEC1.dta
15
+ file: GSEC1.dta
16
16
  idxvars:
17
17
  i: HHID
18
18
  v: comm
@@ -46,7 +46,7 @@ earnings_parquet := $(earnings:.py=.parquet)
46
46
  shocks = $(shell find $(rounds) -name shocks.py)
47
47
  shocks_parquet := $(shocks:.py=.parquet)
48
48
 
49
- ../var/shocks.parquet: shocks.py $(shocks_parquet)
49
+ ../var/shocks.parquet: shocks.py $(shocks_parquet) ../var/other_features.parquet
50
50
  python shocks.py
51
51
 
52
52
 
@@ -0,0 +1,290 @@
1
+ Code,Preferred Label
2
+ 0,---
3
+ 1,Kg
4
+ 2,Gram
5
+ 3,Litre
6
+ 4,Akendo (Small)
7
+ 5,Metre
8
+ 6,Square metre
9
+ 7,Yard
10
+ 8,Millilitre
11
+ 9,Sack (120 kgs)
12
+ 10,Sack (100 kgs)
13
+ 11,Sack (80 kgs)
14
+ 12,Sack (50 kgs)
15
+ 13,Sack (unspecified)
16
+ 14,Jerrican (20 lts)
17
+ 15,Jerrican (10 lts)
18
+ 16,Jerrican (5 lts)
19
+ 17,Jerrican (3 lts)
20
+ 18,Jerrican (2 lts)
21
+ 19,Jerrican (1 lt)
22
+ 20,Tin (Debe) (20 lts)
23
+ 21,Tin (5 lts)
24
+ 22,Plastic Basin (15 lts)
25
+ 23,Bottle(750ml)
26
+ 24,Bottle(500ml)
27
+ 25,Bottle(350ml)
28
+ 26,Bottle(300ml)
29
+ 27,Bottle(250ml)
30
+ 28,Bottle(150ml)
31
+ 29,Kimbo/Cowboy/Blueband Tin (2kg)
32
+ 30,Kimbo/Cowboy/Blueband Tin (1kg)
33
+ 31,Kimbo/Cowboy/Blueband Tin (0.5kg)
34
+ 32,Cup/Mug(0.5lt)
35
+ 33,Glass(0.25lt)
36
+ 34,Ladle(100g)
37
+ 35,Table spoon
38
+ 36,Tea spoon
39
+ 37,Basket (20 kg)
40
+ 38,Basket (10 kg)
41
+ 39,Basket (5 kg)
42
+ 40,Basket (2 kg)
43
+ 41,Loaf (1kg)
44
+ 42,Loaf (500g)
45
+ 43,Buns (200 g)
46
+ 44,Buns (100 g)
47
+ 45,Buns (50 g)
48
+ 46,Bathing soap (Tablet)
49
+ 47,Washing soap (Bar)
50
+ 48,Washing soap (Tablet)
51
+ 49,Packet (2 kg)
52
+ 50,Packet (1 kg)
53
+ 51,Packet (500 g)
54
+ 52,Packet (250 g)
55
+ 53,Packet (100 g)
56
+ 54,Packet(125g)
57
+ 55,Fish Whole (Small)
58
+ 56,Fish Whole (Medium)
59
+ 57,Fish Whole (Large)
60
+ 58,Fish Cut piece (up to 1kg)
61
+ 59,Fish Cut piece (1 - 2 kg)
62
+ 60,Fish Cut piece(Above 2 kg)
63
+ 61,Tray of 30 eggs
64
+ 62,Ream
65
+ 63,Crate
66
+ 64,Heap (unspecified)
67
+ 65,Dozen
68
+ 66,Bundle (Unspecified)
69
+ 67,Bunch (Big)
70
+ 68,Bunch (Medium)
71
+ 69,Bunch (Small)
72
+ 70,Bunch (Big)
73
+ 71,Bunch (Medium)
74
+ 72,Bunch (Small)
75
+ 73,Cluster (Unspecified)
76
+ 74,Gourd (1-5lts)
77
+ 75,Gourd (5-10lts)
78
+ 76,Gourd (Above 10 lts)
79
+ 77,Jug (2 lts)
80
+ 78,Jug (1.5 lts)
81
+ 79,Jug (1 lt)
82
+ 80,Tot (50 ml)
83
+ 81,Tot (sachet)
84
+ 82,Tot (Unspecified)
85
+ 83,Tobacco leaf (Number)
86
+ 84,Pair
87
+ 85,Number of Units (General)
88
+ 86,Acre
89
+ 87,Piece (Big)
90
+ 88,Piece (Medium)
91
+ 89,Piece (Small)
92
+ 90,Heap (Big)
93
+ 91,Heap (Medium)
94
+ 92,Heap (Small)
95
+ 93,Cluster (Big)
96
+ 94,Cluster (Medium)
97
+ 95,Cluster (Small)
98
+ 96,Bundle (Big)
99
+ 97,Bundle (Medium)
100
+ 98,Bundle (Small)
101
+ 99,Others specify
102
+ 100,Fish Whole (Large)
103
+ 101,Fish Whole (Medium)
104
+ 102,Fish Whole (Small)
105
+ 103,Plastic Basin (5 ltrs)
106
+ 104,Glass (500ml)
107
+ 105,Glass (125ml)
108
+ 106,Jug (2.5ltrs)
109
+ 107,Nice cup (100g) - Large
110
+ 108,Nice cup (60g) - Medium
111
+ 109,Nice cup (50g) - Small
112
+ 110,Metallic tumbler (100g) - Big
113
+ 111,Metallic tumbler (50g) - Small
114
+ 112,Plastic tumbler (50g) - Big
115
+ 113,Plastic tumbler (30g) - Small
116
+ 114,Plastic plate (60g) - Large
117
+ 115,Plastic plate (30g) - Small
118
+ 116,Metallic plate (100g) - Large
119
+ 117,Metallic plate (80g) - Small
120
+ 118,Plastic bowl (40g)
121
+ 119,Nomi Tin (1kg)
122
+ 120,Nomi Tin (500g)
123
+ 121,Nomi Tin (250g)
124
+ 122,Nido Tin (400g)
125
+ 123,Akendo (Big)
126
+ 124,Akendo (Medium)
127
+ 125,Akendo (Small)
128
+ 126,Jerrican (500 ml)
129
+ 127,Container (Big)
130
+ 128,Container (Medium)
131
+ 129,Container (Small)
132
+ 130,Container (Smallest)
133
+ 131,Bottle (500g)
134
+ 132,Bottle (350g)
135
+ 133,Sadolin Tin (3ltrs)
136
+ 134,Loaf (1kg)
137
+ 135,Loaf (500g)
138
+ 137,Bottle (1ltr)
139
+ 138,Bottle (1.5ltr)
140
+ 139,Bottle (2ltr)
141
+ 140,Sacket (10g)
142
+ 141,Sacket (15g)
143
+ 142,Sacket (20g)
144
+ 143,Sacket (25g)
145
+ 144,Sacket (30g)
146
+ 145,Sacket (50g)
147
+ 146,Sacket (100g)
148
+ 147,Sacket (150g)
149
+ 104002,---
150
+ 104003,---
151
+ 104087,---
152
+ 104088,---
153
+ 104089,---
154
+ 105091,---
155
+ 105092,---
156
+ 107087,---
157
+ 107088,---
158
+ 107089,---
159
+ 107090,---
160
+ 107091,---
161
+ 107092,---
162
+ 109087,---
163
+ 109088,---
164
+ 109089,---
165
+ 109090,---
166
+ 109092,---
167
+ 111087,---
168
+ 111088,---
169
+ 111089,---
170
+ 111090,---
171
+ 113087,---
172
+ 113088,---
173
+ 113089,---
174
+ 114087,---
175
+ 114089,---
176
+ 121087,---
177
+ 121089,---
178
+ 122055,---
179
+ 122056,---
180
+ 122057,---
181
+ 123055,---
182
+ 123056,---
183
+ 123057,---
184
+ 123058,---
185
+ 123059,---
186
+ 123060,---
187
+ 123090,---
188
+ 123091,---
189
+ 123092,---
190
+ 124088,---
191
+ 125050,---
192
+ 125051,---
193
+ 125052,---
194
+ 128004,---
195
+ 128005,---
196
+ 128051,---
197
+ 128052,---
198
+ 128053,---
199
+ 129001,---
200
+ 129002,---
201
+ 129003,---
202
+ 129004,---
203
+ 130090,---
204
+ 130091,---
205
+ 130092,---
206
+ 131093,---
207
+ 131094,---
208
+ 131095,---
209
+ 132087,---
210
+ 132088,---
211
+ 132089,---
212
+ 133087,---
213
+ 133088,---
214
+ 133089,---
215
+ 133090,---
216
+ 133092,---
217
+ 135087,---
218
+ 135088,---
219
+ 135089,---
220
+ 135090,---
221
+ 135091,---
222
+ 135092,---
223
+ 135096,---
224
+ 135097,---
225
+ 135098,---
226
+ 136087,---
227
+ 136088,---
228
+ 136089,---
229
+ 136090,---
230
+ 136091,---
231
+ 136092,---
232
+ 137087,---
233
+ 137088,---
234
+ 137089,---
235
+ 138096,---
236
+ 138097,---
237
+ 138098,---
238
+ 151024,---
239
+ 151026,---
240
+ 152024,---
241
+ 153001,---
242
+ 154001,---
243
+ 155054,---
244
+ 155099,---
245
+ 157001,---
246
+ 158024,---
247
+ 158026,---
248
+ 159024,---
249
+ 160001,---
250
+ 161001,---
251
+ 164087,---
252
+ 164088,---
253
+ 164089,---
254
+ 165087,---
255
+ 165088,---
256
+ 165089,---
257
+ 166087,---
258
+ 166088,---
259
+ 166089,---
260
+ 167087,---
261
+ 167088,---
262
+ 167089,---
263
+ 167090,---
264
+ 167091,---
265
+ 167092,---
266
+ 168087,---
267
+ 168088,---
268
+ 168089,---
269
+ 168090,---
270
+ 168091,---
271
+ 168092,---
272
+ 169087,---
273
+ 169088,---
274
+ 169089,---
275
+ 170087,---
276
+ 170088,---
277
+ 170089,---
278
+ 171087,---
279
+ 171088,---
280
+ 171089,---
281
+ 807087,---
282
+ 807089,---
283
+ 136,---
284
+ 156087,---
285
+ 139093,---
286
+ 142092,---
287
+ 156096,---
288
+ 156090,---
289
+ 181087,---
290
+ 142090,---
lsms_library/country.py CHANGED
@@ -210,7 +210,7 @@ class Wave:
210
210
  df_edit_function = mapping_info.pop('df_edit')
211
211
  dfs = []
212
212
  for file, mappings in mapping_info.items():
213
- df = df_data_grabber(f'{self.folder}/Data/{file}', mappings['idxvars'], **mappings['myvars'], convert_categoricals=convert_cat)
213
+ df = df_data_grabber(f'lsms_library/countries/{self.folder}/Data/{file}', mappings['idxvars'], **mappings['myvars'], convert_categoricals=convert_cat)
214
214
  df = check_adding_t(df)
215
215
  # Oddity with large number for missing code
216
216
  na = df.select_dtypes(exclude=['object', 'datetime64[ns]']).max().max()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: LSMS_Library
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: Abstraction layer for Living Standards Measurement Survey data
5
5
  License: CC-BY-4.0
6
6
  Author: Ethan Ligon
@@ -7309,7 +7309,6 @@ lsms_library/countries/Nigeria/_/household_roster.py,sha256=CezzWwnXj-2KluD0PtYe
7309
7309
  lsms_library/countries/Nigeria/_/nigeria.py,sha256=VrFJfQHQtx22siFINUaCv1KIW2A5lrBeLIRR4W-WFTk,227
7310
7310
  lsms_library/countries/Nigeria/_/nonfood_expenditures.py,sha256=dL2vh928a3g-G29uH2Eki6Aaq6Bs6_kJtYaen6nMmXw,584
7311
7311
  lsms_library/countries/Nigeria/_/nonfood_items.json,sha256=77fSHMuKy1pSbpNgwK0ZZJaEj9coiGvg_3ktfImQL8o,18785
7312
- lsms_library/countries/Nigeria/_/predicted_prices.py,sha256=u8rGKsQKR2he1I4HhhfoLyPhEPnvXfd-nFwSjUpVjdo,1930
7313
7312
  lsms_library/countries/Nigeria/_/unitvalues.py,sha256=4J3FlLWgN3BS-IZl6d26gFFw6N9ANXRIQXbEsMz_LmA,611
7314
7313
  lsms_library/countries/Nigeria/var/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7315
7314
  lsms_library/countries/Pakistan/1991/Data/.gitignore,sha256=_mNlocngcNbGaSLbmMPn3e76as1iWisON-BsRnpG76U,2068
@@ -9482,7 +9481,7 @@ lsms_library/countries/Uganda/2005-06/Documentation/UNHS.2005-06.CommQuest_final
9482
9481
  lsms_library/countries/Uganda/2005-06/Documentation/UNHS.2005-06.Household.Questionnaire.FINAL.pdf.dvc,sha256=NuESUFEsMG10Gm0poidecd3lTFVwh4-2j22ayosZtkY,129
9483
9482
  lsms_library/countries/Uganda/2005-06/Documentation/UNHS.2005-06.Interviewer.Manual.FINAL.pdf.dvc,sha256=6urVSwN3_57SkfWcieq6NzlTbbVm9gxt0WHg5ywuXXs,123
9484
9483
  lsms_library/countries/Uganda/2005-06/_/assets.py,sha256=Lh9BVYNv4DRRgjC6h1S2HK_JMmjLzn8LQYaUpv8yH9w,417
9485
- lsms_library/countries/Uganda/2005-06/_/data_info.yml,sha256=g3fGD_mEwJtKOHnz1Ya7UjH5_y5NG4dcC967EGNHbBw,856
9484
+ lsms_library/countries/Uganda/2005-06/_/data_info.yml,sha256=nku4Yk-5CxHpq7WcPb5LmZOeC4KNAbk22NHIXFCduFw,848
9486
9485
  lsms_library/countries/Uganda/2005-06/_/earnings.py,sha256=HVM6pmh6_KuKVN_Cl9MQQ2GhbZxpWsztSoXw9jlE5oE,559
9487
9486
  lsms_library/countries/Uganda/2005-06/_/education_expenses.py,sha256=HaBLCZfr8RRlfj9rDEvPg51KOK6uxii8D7M4Lk_LbuU,1466
9488
9487
  lsms_library/countries/Uganda/2005-06/_/enterprise_income.py,sha256=dwJvipFBT9O7rjTAqZNfjSTCNp8aKeqEWLGeonzSmfc,932
@@ -10495,7 +10494,7 @@ lsms_library/countries/Uganda/2019-20/_/nonfood_expenditures.py,sha256=CRO6B7Fk0
10495
10494
  lsms_library/countries/Uganda/2019-20/_/other_features.py,sha256=Tvevvw888c0NKnHB5EJ4AZko-XIzT6SbGLdkUvB6wT8,1012
10496
10495
  lsms_library/countries/Uganda/2019-20/_/plots.py,sha256=mbqRPKeK5Z-phCZy1zIxbsPXXZiFAvu7Dq-oMtsrPTM,880
10497
10496
  lsms_library/countries/Uganda/2019-20/_/shocks.py,sha256=L5nYYT82m_ACGGSaUtnpGmm7Bn7q-rdqDGvGEc0jcYA,2627
10498
- lsms_library/countries/Uganda/_/Makefile,sha256=A9jTHLEKlF9hkP5X8wkRU-muNM7zqOpa1O2RNhfJxMM,3559
10497
+ lsms_library/countries/Uganda/_/Makefile,sha256=dU7dNM7YXwjTspGlHvYx9a8UwrbxhiKznYAMPohKxeQ,3589
10499
10498
  lsms_library/countries/Uganda/_/assets.py,sha256=jfwV44k96WZ7bANodoZ8BAMO-baQy1FKuCDRKPoqFwA,665
10500
10499
  lsms_library/countries/Uganda/_/categorical_mapping.org,sha256=XD4QBTKwdIEjScBEElpQ0BijfscmbnXfLS8dLQtDpR0,11822
10501
10500
  lsms_library/countries/Uganda/_/compare_unit_labels.py,sha256=_8R3C0EUAjUZtsutmWayGXjEJs7UzOrNfsD1d5TrR_E,276
@@ -10527,19 +10526,20 @@ lsms_library/countries/Uganda/_/panel_ids.py,sha256=lKXBBI-iVzPgDV0kOfq9iA3FUolP
10527
10526
  lsms_library/countries/Uganda/_/regions_are_markets.py,sha256=SCO_yvRTaC8B8QiJASnPrLsTHq_x57fyC15a79LjhXY,1107
10528
10527
  lsms_library/countries/Uganda/_/shocks.py,sha256=ZxpyJFwKwX02imDI15MxWCf4q-ehWzVb3ar8yfi3Zow,746
10529
10528
  lsms_library/countries/Uganda/_/uganda.py,sha256=NtH1wllwPOwOObhYrxpgedGo5fkCfD6aJx8euxSppbg,9248
10529
+ lsms_library/countries/Uganda/_/unitlabels.csv,sha256=UCO_geSRyI6iJDsfeWrTJ5HSafBjMDG__nX5MT-4MZ4,4433
10530
10530
  lsms_library/countries/Uganda/_/unitlabels.py,sha256=ZegaWAArOeRNKL9O1wpCeQL0QjUCsZkMg2zXqmXgMuM,36329
10531
10531
  lsms_library/countries/Uganda/_/units.org,sha256=5wU9027ikC_yCneE-uqJGTwlrmJ5Pys9AF1iTUNX3So,98391
10532
10532
  lsms_library/countries/Uganda/_/unitvalues.py,sha256=-pY-4OYLJQ-SrCv6xB1FRLevO7yF_KejlL5YV-yp9WY,565
10533
10533
  lsms_library/countries/Uganda/_/updated_ids.json,sha256=pgkwK6gcYKufkWt0GS9G39WPF9w7_rxW_bIO-lSwJW4,462159
10534
10534
  lsms_library/countries/Uganda/var/.gitkeep,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10535
10535
  lsms_library/countries/Uganda/var/README,sha256=pOIlG6aObxWzUedoWjt9Z5-FG28UXrtws6ktD6GhWn0,116
10536
- lsms_library/country.py,sha256=VwjDZATDZUro6WUV81BVXaA4W69rF3Pt1BDRUdkmxvo,33821
10536
+ lsms_library/country.py,sha256=mQWujI2N79sO6zSL_ATMA9lST5eSEToI9U4U95oluHk,33844
10537
10537
  lsms_library/data_info.yml,sha256=Y5GaP52AzJsIvXtioSJP4R63opZcqhjQFsGLjad-2U4,478
10538
10538
  lsms_library/demands.py,sha256=UCnUTjoE6FHt32XvRm4hZdIBryOj_YQU4im0-Wu9y7U,749
10539
10539
  lsms_library/harmony.py,sha256=hEGLJUnWBXdyGeAAr7qgCFZ0Q-KsiqjBxHrtYbZ8Ngs,2742
10540
10540
  lsms_library/local_tools.py,sha256=YXqowOUzW4U61CtkDeRlNB2XSNWhW0s9SQwyFpN9O5o,40712
10541
10541
  lsms_library/transformations.py,sha256=uBSGfUAjWMrqSOmxdYYzi9csf8WvjaGCC7lzflJObtU,3661
10542
- lsms_library-0.2.2.dist-info/LICENSE.txt,sha256=qImFXcRJwxIHS80FE7uOx6FhmLY8apd4Y12aR54QU7w,282
10543
- lsms_library-0.2.2.dist-info/METADATA,sha256=Tw2oMZz_9twYa0iZ2obfFsq0qNRsB7gMrSl8tB5h7Vk,4777
10544
- lsms_library-0.2.2.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
10545
- lsms_library-0.2.2.dist-info/RECORD,,
10542
+ lsms_library-0.2.4.dist-info/LICENSE.txt,sha256=qImFXcRJwxIHS80FE7uOx6FhmLY8apd4Y12aR54QU7w,282
10543
+ lsms_library-0.2.4.dist-info/METADATA,sha256=103-V-CubxZcOAn4XRw-p_nKJXq-SUOPissfIq3rZUY,4777
10544
+ lsms_library-0.2.4.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
10545
+ lsms_library-0.2.4.dist-info/RECORD,,
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env python
2
- """
3
- Use methods of Summer (1973) to predict prices for different goods, units, places, and times.
4
- """
5
- import numpy as np
6
- import pandas as pd
7
- import pylab as pl
8
- import matplotlib.cm as cm
9
- from cfe.estimation import ols
10
-
11
- P = []
12
- for t in ['2010-11','2012-13','2015-16','2018-19']:
13
- P.append(pd.read_pickle('../%s/_/individual_unit_values.pickle' % t))
14
-
15
- p = pd.concat(P,axis=0)
16
-
17
- # Eliminate infinities & zeros
18
- p = p.replace(np.inf,np.nan)
19
- p = p.replace(-np.inf,np.nan)
20
- p = p.replace(0,np.nan)
21
-
22
- logp = np.log(p)
23
-
24
- # Construct different "settings"
25
- s=pd.DataFrame({'Good-Setting':list(zip(logp.index.get_level_values('t'),
26
- logp.index.get_level_values('m'),
27
- logp.index.get_level_values('i')))},index=logp.index).squeeze()
28
-
29
- Settings = pd.get_dummies(s)
30
-
31
- Units = pd.get_dummies(logp.index.get_level_values('u'))
32
- Units.index = logp.index
33
- del Units['Kg'] # Reference prices in Kgs.
34
-
35
- X = pd.concat([Settings.reset_index(drop=True),
36
- Units.reset_index(drop=True)],axis=1)
37
-
38
- X.index = logp.index
39
-
40
- bhat=ols(X,logp,return_se=False)[0]
41
- logphat=X.dot(bhat.T)
42
- logphat.index=logp.index
43
-
44
- prices=logphat.groupby(level=['t','m','i']).median().unstack()
45
- prices.columns=prices.T.index.droplevel(0)
46
- prices0=logp.groupby(level=['t','m','i']).median().unstack()
47
- prices0.columns=prices0.T.index.droplevel(0)
48
-
49
- pl.figure(1,figsize=(10,10))
50
- pl.clf()
51
-
52
- colors = iter(cm.rainbow(np.linspace(0, 1, prices.shape[1])))
53
-
54
- for i in prices:
55
- pl.scatter(prices[i],prices0[i],color=next(colors))
56
-
57
- pl.legend(prices.columns, loc='lower right', ncol=2,scatterpoints=2)
58
- v=pl.axis()
59
- pl.axis((v[0],v[1]*1.1,v[2],v[3]))
60
-
61
- pl.xlabel('Predicted log prices')
62
- pl.ylabel('Observed log prices')
63
- pl.savefig('/tmp/predicted_prices_scatter.png')
64
-
65
- V=pd.concat([prices.stack(),prices0.stack()],axis=1).dropna(how='any').cov()
66
- print("R^2=%6.4f" % (V.iloc[0,0]/V.iloc[1,1],))