User Tools

Site Tools


tutorials:python_quick_reference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:python_quick_reference [2021/08/03 16:07]
marcus.williams [Data interrogation]
tutorials:python_quick_reference [2021/08/06 22:20] (current)
marcus.williams [Data interrogation]
Line 76: Line 76:
 <​code>​ <​code>​
 df_structure = gpd.read_file(myLayers.gdb,​ layer='​structure'​) df_structure = gpd.read_file(myLayers.gdb,​ layer='​structure'​)
 +</​code>​
 +
 +Round trip export/​import for json files, as Python dictionaries or lists. Requires ''​import json''​.
 +
 +<​code>​
 +filename = '​folderX/​list_CEUDSector_ind.json'​
 +with open(filename,​ '​w',​ encoding='​utf-8'​) as f:
 +    json.dump(l_CEUDSector_ind,​ f, ensure_ascii=False,​ indent=4)
 +</​code>​
 +
 +<​code>​
 +filename = '​folderX/​list_CEUDSector_ind.json'​
 +with open(filename) as data_file:
 +    l_CEUDSector_ind= json.load(data_file)
 </​code>​ </​code>​
  
Line 108: Line 122:
     index=['​propType'​],​     index=['​propType'​],​
     columns=['​strucType'​],​     columns=['​strucType'​],​
-    margins=True,+    margins=False,
     aggfunc=np.sum)     aggfunc=np.sum)
 </​code>​ </​code>​
tutorials/python_quick_reference.1628006823.txt.gz ยท Last modified: 2021/08/03 16:07 by marcus.williams