ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Aide
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plateforme cartographique de votre organisation

ArcGIS Desktop

Un SIG professionnel complet

ArcGIS Enterprise

SIG dans votre entreprise

ArcGIS Developers

Outils de création d'applications de localisation

ArcGIS Solutions

Modèles d'applications et de cartes gratuits pour votre secteur d'activité

ArcGIS Marketplace

Téléchargez des applications et des données pour votre organisation.

  • Documentation
  • Support
Esri
  • Se connecter
user
  • Mon profil
  • Déconnexion

ArcMap

  • Accueil
  • Commencer
  • Carte
  • Analyser
  • Gérer les données
  • Outils
  • Extensions

NumPyArrayToTable

  • Résumé
  • Discussion
  • Syntaxe
  • Exemple de code

Résumé

Convertit un tableau structuré Numpy en table.

Discussion

Si un nom de champ du tableau en entrée n'est pas valide pour le format de sortie, il sera validé. Tous les caractères non valides du nom de champ en entrée sont remplacés par un trait de soulignement (_) dans le nom de champ en sortie. Les restrictions de nom de champ dépendent de la base de données spécifique utilisée.

NumPyArrayToTable ne remplacera pas une table existante, même si l'environnement overwriteOutput est défini sur Vrai.

NumPyArrayToTable n'accepte que les tableaux structurés. Si vous avez un NumPy ndarray standard, il devra tout d'abord être converti en tableau structuré. À continuation, nous transposons le tableau d'origine, et utilisons la méthode numpy.core.records.fromarrays pour créer le nouveau tableau structuré.

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.

Syntaxe

NumPyArrayToTable (in_array, out_table)
ParamètreExplicationType de données
in_array

Tableau structuré NumPy

Le tableau doit comprendre des noms de champs et des dtypes NumPy

NumPyArray
out_table

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

String

Exemple de code

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")

Rubriques connexes

  • NumPyArrayToFeatureClass
  • FeatureClassToNumPyArray
  • TableToNumPyArray
  • Utilisation de NumPy dans ArcGIS
  • ExtendTable

ArcGIS Desktop

  • Accueil
  • Documentation
  • Support

ArcGIS

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

A propos d'Esri

  • A propos de la société
  • Carrières
  • Blog d’Esri
  • Conférence des utilisateurs
  • Sommet des développeurs
Esri
Donnez-nous votre avis.
Copyright © 2021 Esri. | Confidentialité | Légal