Skip to main content

TableToArrowTable

汇总

TableToArrowTable 函数用于将表或要素类转换为 Apache Arrow 表。

讨论

Apache Arrow 是分栏式数据的标准跨平台内存表达形式,用于在大数据分析系统之间高效传输数据。 有关详细信息,请参阅 ArcGIS 中的 Apache Arrow

语法

TableToArrowTable(in_table, {field_names}, {where_clause}, {geometry_encoding})

参数 说明 数据类型

in_table

要素类、图层、表或表视图。

String

field_names

字段名称列表(或组)。 对于单个字段,可以使用一个字符串,而不使用字符串列表。

(默认值为 "")

String

where_clause

用于限制所返回的记录的可选表达式。 有关 WHERE 子句和 SQL 语句的详细信息,请参阅 在 ArcGIS 中使用的查询表达式的 SQL 参考

(默认值为 "")

String

geometry_encoding

Specifies the geometry encoding of the geometry column in the resulting Arrow table.

  • ESRISHAPE—Native binary geometry encoding

  • ESRIJSON—Native JSON format geometry encoding

  • GEOJSON—Open standard JSON format geometry encoding.

  • WKT—Well-known text (WKT) geometry encoding.

  • WKB—Well-known binary (WKB) geometry encoding

注:

If no geometry field is specified in the field_names argument or the in_table value is a non-spatial table, this argument will be ignored. In both cases, the resulting Arrow table will not contain a geometry column.

(默认值为 ESRISHAPE)

String

返回值

数据类型 说明

PyArrowTable

输出 pyarrow.Table 。 请参阅 pyarrow.Table 对象 API

代码示例

TableToArrowTable 示例 1

将要素类转换为 Arrow 表并计算数据集中的县数。

import arcpy

input = r'C:\data\usa.gdb\USA\counties'
arrow_table = arcpy.da.TableToArrowTable(input)

# Get the number of counties in the dataset
count = arcpy.management.GetCount(arrow_table)
print(f"Number of US Counties: {count}")
TableToArrowTable 示例 2

通过 WKT 几何编码将要素类转换为 Arrow 表。

import arcpy

input = r'C:\data\usa.gdb\USA\counties'
arrow_table = arcpy.da.TableToArrowTable(input, geometry_encoding="WKT")