English 中文(简体)
ArcGIS 下表: 具有相同价值的多个属性的领域一览表
原标题:ArcGIS Pro table field calculation: SUM of field where multiple attributes have same value

Im 从事ArcGIS项目,该表载有时间数据,相关领域包括:

  • Zipcode
  • Year
  • Sales_Annual
  • Sales_Cumulative

目的是计算第四点,汇总所有年份的每轮计算法可征税的属性销售数据。 E.g. 如果同一手提代码各有10个不同年份,我想将销售单元中所有10个单位归为所有10个。

I tried to see if I could use the field calculator function, but was not familiar enough to work out how to calculate for what I needed.

我的另一种选择是把他们从Excel的ArcGIS Pro外传。

问题回答

You could use the tools Summary Statistics, Add Join and Remove Join.

  1. Use Summary Statistics to calculate the cumulative annual sale
  1. Join your table and the result of Summary Statistics using the field Zipcode
  1. 使用<条码>计算外地至<条码>

  2. Remove the join by using Remove Join

下面是该模式的简介:


Alternatively, you could use Python and a Spatially enabled DataFrame:

import pandas as pd

from arcgis.features import GeoAccessor, GeoSeriesAccessor

table = r"Default.gdbSales"

# load table
sdf = pd.DataFrame.spatial.from_table(filename=table, skip_nulls=False)

# calulate the total sales by zip code 
total_sales_by_zipcode = sdf.groupby(["Zipcode"])["Sales_Annual"].sum()

sdf["Sales_Cumulative"] = sdf["Zipcode"].apply(lambda x: total_sales_by_zipcode[x])

sdf.spatial.to_table(location=table, overwrite=True)

注:

  • This overwrites your table.
  • When using sdf.spatial.to_table, all field names are suddenly lower case.
  • Use skip_nulls when reading the table, otherwise no data is read due to a "bug". See here.




相关问题
selecting textareas

I am trying to select specific element types in a row and change their attribute, specifically the id and name attributes. Using the following works fine for single line text input boxes: $( input:...

Performance overhead of using attributes in .NET

1.. Is there any performance overhead caused by the usage of attributes? Think for a class like: public class MyClass { int Count {get;set;} } where it has 10 attibutes (...

How to remove "onclick" with JQuery?

PHP code: <a id="a$id" onclick="check($id,1)" href="javascript:void(0)" class="black">Qualify</a> I want to remove the onclick="check($id,1) so the link cannot be clicked or "check($id,...

Unit Test for Exceptions Message

Is there a simple (Attribute-driven) way to have the following test fail on the message of the exception. [TestMethod()] [ExpectedException(typeof(ArgumentException))] public void ExceptionTestTest() ...

热门标签