ExtendTable

Zusammenfassung

Verbindet den Inhalt eines strukturierten NumPy-Arrays auf der Grundlage eines gemeinsamen Attributfeldes mit einer Tabelle. Die Eingabetabelle wird so aktualisiert, dass sie die Felder aus der Join-Tabelle enthält.

Diskussion

Die Datensätze im Feld in_array werden den Datensätzen im Feld in_table zugeordnet. Eine Übereinstimmung liegt vor, wenn die Werte von table_match_field und array_match_table gleich sind. Die Verbindung ist permanent.

NumPy is a fundamental package for scientific computing in Python, including support for a powerful N-dimensional array object. For more information, see Working with NumPy in ArcGIS.

Syntax

ExtendTable (in_table, table_match_field, in_array, array_match_field, {append_only})
ParameterErläuterungDatentyp
in_table

The target table to which fields from a NumPy array will be appended.

String
table_match_field

A field name from in_table to use as a match to the array.

String
in_array

A NumPy structured array to be appended to in_table.

Matching in_array field values must be unique.

NumPyArray
array_match_field

A field name from in_array to use to match.

String
append_only

Controls how fields are added or updated in the existing table.

If True, fields will be appended to the existing table only. If any of the NumPy field names exist already in the in_table, ExtendTable will fail.

If False, existing fields will be updated if they share a common field name with fields in the NumPy array. Any matching fields must have a compatible field type. For example, a NumPy string field cannot be appended into a numeric field.

(Der Standardwert ist True)

Boolean

Codebeispiel

ExtendTable: Beispiel

Verwenden Sie die Funktion ExtendTable zum Verbinden eines NumPy-Arrays mit einer vorhandenen Tabelle.


import arcpy
import numpy

# numpy array
array = numpy.array(
    [(1, "a", 1111.0), (2, "b", 2222.22)],
    numpy.dtype(
        [("idfield", numpy.int32), ("textfield", "|S256"), ("doublefield", "<f8")]
    ),
)

# Append the array to an existing table
arcpy.da.ExtendTable("c:/data/base.gdb/current_table", "tableid", array, "idfield")

Verwandte Themen