ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Ayuda
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plataforma de representación cartográfica para tu organización

ArcGIS Desktop

Un completo SIG profesional

ArcGIS Enterprise

SIG en tu empresa

ArcGIS Developers

Herramientas para crear aplicaciones basadas en la ubicación

ArcGIS Solutions

Plantillas de aplicaciones y mapas gratuitas para tu sector

ArcGIS Marketplace

Obtén aplicaciones y datos para tu organización.

  • Documentación
  • Soporte
Esri
  • Iniciar sesión
user
  • Mi perfil
  • Cerrar sesión

ArcMap

  • Inicio
  • Introducción
  • Cartografiar
  • Analizar
  • Administrar datos
  • Herramientas
  • Extensiones

NumPyArrayToTable

  • Resumen
  • Debate
  • Sintaxis
  • Muestra de código

Resumen

Convierte una matriz estructurada NumPy en una tabla.

Debate

Si un nombre de campo de la matriz de entrada no es válido para el formato de salida, se validará. Todos los caracteres no válidos del nombre del campo de entrada se sustituyen por un guion bajo (_) en el nombre del campo de salida. Las restricciones del nombre de campo dependen de la base de datos concreta que se utilice.

NumPyArrayToTable no sobrescribirá ninguna tabla existente, ni siquiera si el entorno overwriteOutput está definido como True.

NumPyArrayToTable solo acepta matrices estructuradas. Si tiene un ndarray NumPy normal, primero será necesario convertirlo en una matriz estructurada. A continuación, se realiza una transposición de la matriz original y se utiliza el método numpy.core.records.fromarrays para crear la nueva matriz estructurada.

import numpy
import arcpy
import os

a = numpy.array([(0.2, 1.0), (0.5, 2.5)])
struct_array = numpy.core.records.fromarrays(
    a.transpose(), numpy.dtype([('Value1', 'f8'), ('Value2', 'f8')]))

arcpy.da.NumPyArrayToTable(struct_array, 'c:/data/f.gdb/array_output')

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.

Sintaxis

NumPyArrayToTable (in_array, out_table)
ParámetroExplicaciónTipo de datos
in_array

Una matriz estructurada NumPy.

La matriz debe incluir nombres de campo y dtypes NumPy.

NumPyArray
out_table

The table to which the records from the NumPy array will be written.

String

Muestra de código

import arcpy
import numpy

# Create a simple array from scratch
#
inarray = numpy.array([('a', 1, 1111.0), ('b', 2, 2222.22)],
                      numpy.dtype([('textfield', '|S256'),
                                   ('intfield',numpy.int32),
                                   ('doublefield','<f8')]))

# Convert array to a geodatabase table
#
arcpy.da.NumPyArrayToTable(inarray, "c:/data/gdb.gdb/out_table")

import arcpy
import numpy

# Create a simple array from scratch using a list of values
#
recs = [['M', 64, 75.0],['F', 25, 60.0]]
dts = {'names': ('gender','age','weight'),
       'formats':('S1', numpy.uint8, numpy.float32)}
array = numpy.rec.fromrecords(recs, dtype=dts)

# Convert array to a geodatabase table
#
arcpy.da.NumPyArrayToTable(array, "c:/data/gdb.gdb/out_table")

Temas relacionados

  • NumPyArrayToFeatureClass
  • FeatureClassToNumPyArray
  • TableToNumPyArray
  • Trabajar con NumPy en ArcGIS
  • ExtendTable

ArcGIS Desktop

  • Inicio
  • Documentación
  • Soporte

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

Acerca de Esri

  • Quiénes somos
  • Empleo
  • Blog de Esri
  • Conferencia de usuarios
  • Cumbre de desarrolladores
Esri
Díganos su opinión.
Copyright © 2021 Esri. | Privacidad | Legal