File tree Expand file tree Collapse file tree 2 files changed +26
-34
lines changed
Expand file tree Collapse file tree 2 files changed +26
-34
lines changed Original file line number Diff line number Diff line change 299299"""
300300CONS_DICT = {
301301 "Food" : [
302- "cagri" ,
302+ "cceri" ,
303+ "cvegf" ,
303304 "clani" ,
304305 "cfore" ,
305306 "cfish" ,
311312 "cfats" ,
312313 "cdair" ,
313314 "cgrai" ,
314- "cstar" ,
315315 "cafee" ,
316316 "cbake" ,
317317 "csuga" ,
318318 "cconf" ,
319319 "cpast" ,
320- "cofoo" ,
321320 "calcb" ,
322321 "csftd" ,
323322 "ctoba" ,
324323 ],
325324 "Energy and extraction" : [
326325 "ccoal" ,
326+ "colig" ,
327327 "cmore" ,
328+ "cquar" ,
328329 "comin" ,
329330 "celcg" ,
330331 ],
340341 "cwood" ,
341342 "cpapp" ,
342343 "cprnt" ,
344+ "ccoke" ,
343345 "cpetr" ,
344346 "cbchm" ,
345- "cfert" ,
346347 "cpain" ,
347348 "cphar" ,
348349 "csoap" ,
349350 "coche" ,
350351 "ctyre" ,
351- "corub" ,
352352 "cplas" ,
353353 "cglas" ,
354354 "ccera" ,
363363 ],
364364 "Durables" : [
365365 "cirst" ,
366+ "cimet" ,
366367 "cnfme" ,
367368 "cstrm" ,
368- "ctank" ,
369369 "cofbm" ,
370370 "cengt" ,
371- "cpump" ,
372- "cgear" ,
373371 "clift" ,
374372 "cgenm" ,
375373 "cspcm" ,
379377 "crdtv" ,
380378 "cmeda" ,
381379 "cmtvp" ,
380+ "cmbod" ,
382381 "cship" ,
383382 "crail" ,
384383 "cairc" ,
385384 "coteq" ,
386385 "ccnst" ,
387386 ],
388387 "Services" : [
389- "ccsrv " ,
390- "ctrad " ,
391- "cacco " ,
392- "ccats " ,
388+ "cwhol " ,
389+ "creta " ,
390+ "chotl " ,
391+ "crest " ,
393392 "cptrp" ,
394393 "cftrp" ,
395394 "ctrps" ,
399398 "cfins" ,
400399 "cinsp" ,
401400 "cofin" ,
401+ "ccrpf" ,
402402 "creal" ,
403+ "crrea" ,
403404 "crent" ,
404405 "crsea" ,
405406 "clacc" ,
410411 "cpuba" ,
411412 "ceduc" ,
412413 "cheal" ,
413- "cosrv" ,
414+ "ccmemb" ,
415+ "centa" ,
416+ "cpers" ,
417+ "cdoms" ,
414418 ],
415419}
416420PROD_DICT = {
470474 "aplas" ,
471475 "aglss" ,
472476 "anmmi" ,
473- "abisc" ,
474- "anfme" ,
477+ "amets" ,
475478 "afabm" ,
476479 "amach" ,
477480 "aemch" ,
Original file line number Diff line number Diff line change 55
66"""
77Read in Social Accounting Matrix (SAM) file
8+ This is the most recent SAM for 2019 available from the following page as a downloadable zip folder from UNU WIDER:
9+ https://www.wider.unu.edu/sites/default/files/Publications/Technical-note/tn2023-1-2019-SASAM-for-distribution.zip
810"""
911# Read in SAM file
1012storage_options = {"User-Agent" : "Mozilla/5.0" }
11- SAM_path = "https://www.wider.unu.edu/sites/default/files/Data/SASAM-2015-Data-Resource.xlsx"
12- SAM_path_alt = "https://raw.githubusercontent.com/EAPD-DRB/SAM-files/main/Data/ZAF/SASAM-2015-Data-Resource.xlsx"
13+ SAM_path = "https://raw.githubusercontent.com/EAPD-DRB/SAM-files/main/Data/ZAF/tn2023-1-2019-SASAM-for-distribution.xlsx"
1314
1415
1516def read_SAM ():
1617 if is_connected ():
1718 try :
1819 SAM = pd .read_excel (
1920 SAM_path ,
20- sheet_name = "Micro SAM 2015" ,
21- skiprows = 6 ,
21+ sheet_name = "SASAM 2019 61Ind 4Educ" , # Can alternatively use sheet_name="SASM 2019 61Ind4Occ"
22+ skiprows = 3 ,
2223 index_col = 0 ,
2324 storage_options = storage_options ,
2425 )
25- print ("Successfully read SAM from WIDER ." )
26+ print ("Successfully read SAM from Github repository ." )
2627 except Exception as e :
27- print (f"Failed to read from WIDER: { e } " )
28- try :
29- # Attempt to read from the GitHub repository
30- SAM = pd .read_excel (
31- SAM_path_alt ,
32- sheet_name = "Micro SAM 2015" ,
33- skiprows = 6 ,
34- index_col = 0 ,
35- storage_options = storage_options ,
36- )
37- print ("Successfully read SAM from GitHub repository." )
38- except Exception as e :
39- print (f"Failed to read from the GitHub repository: { e } " )
40- SAM = None
28+ print (f"Failed to read from the GitHub repository: { e } " )
29+ SAM = None
4130 # If both attempts fail, SAM will be None
4231 if SAM is None :
4332 print ("Failed to read SAM from both sources." )
You can’t perform that action at this time.
0 commit comments