markdown 使用ArcPy为要素类中的字段生成基本摘要统计信息

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 使用ArcPy为要素类中的字段生成基本摘要统计信息相关的知识,希望对你有一定的参考价值。

import arcpy
import statistics

def basic_fc_stats(fc, field):
	field_vals = []
	total = 0
	row_count = 0
	with arcpy.da.SearchCursor(fc, field) as cursor:
		for row in cursor:
			total = total + row[0]
			row_count+=1
			field_vals.append(row[0])
	mean = statistics.mean(field_vals)
	median = statistics.median(field_vals)
	stdev = statistics.stdev(field_vals)
	summary = {'sum': total, 'row_count': row_count, 'mean': mean, 'median': median, 'stdev': stdev}
	return summary
Generating summary statistics in ArcGIS is a bit more complicated than it needs to be. The Summary Statistics tool requires that you return your output to some sort of tabular data file. Sometimes you just need to see the number really quickly or see how they change if you filter the data differntly. This is function is the beginnings of a simple tool to generate summary statistics for a given field in a feature class. The function returns a dictionary containing the number of entries, the sum of the entries, and mean/median/standard deviatation value of the entries for the inputed field.

以上是关于markdown 使用ArcPy为要素类中的字段生成基本摘要统计信息的主要内容,如果未能解决你的问题,请参考以下文章

arcpy脚本使用多接图表图斑对对应多幅影像进行裁边处理

基于arcpy实现工作中需要实现功能的经验和代码总结:

使用python从xls坐标文件中生成面要素

arcpy arcgis python实例教程--原点夹角距离定义线(坐标正算)

arcpy创建点线面(孔洞环多部件)要素要素类

python 检查列表中的要素类是否在其属性表#python#arcpy #gis中具有相同数量的观察值