Esri / Esri/arcgis-python-api

GeoAccessor.from_table add parameter to avoid using TableToNumPyArray

Offen
#1,733 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

enhancement
Vorherrschende Sprache
Python
Sterne
2.2k
Forks
1.1k
Ø Merge
2 Std. 40 Min.
Gemergte PRs (30 T.)
2

Beschreibung

Is your feature request related to a problem? Please describe.
It would be cool a param to avoid TableToNumPyArray or just set the default as the other way.
image

from arcgis.features import GeoAccessor
import os
gdb_path = r"<path>"
feature_name = r"<featurename>"
df1 = GeoAccessor.from_table(os.path.join(gdb_path, feature_name), skip_nulls=False, null_value='')

The problem is using de search cursor would return a format with pd.NA, Int32, and so on....

Describe the solution you'd like
The default to be the search cursor implementation,

Describe alternatives you've considered
When using tables I`m copying the code from the GeoAccessor and putting it a function or class, like below

def arcpy_to_df(table_path: str, where: Optional[str]=None) -> Union[pd.DataFrame, None]:
    """
    ETL to load arcpy to pandas DataFrame
    :param table_path: full path to table (gdb, sde or shape)
    :param where: Optional, SQL where clause to filter data
    """

    with arcpy.da.SearchCursor(
            in_table=table_path,
            field_names="*",
            where_clause=where,
    ) as scur:
        array = [row for row in scur]
        df = pd.DataFrame(array, columns=scur.fields)
    try:
        return df.convert_dtypes()
    except Exception:
        return df

Additional context
Add any other context or screenshots about the feature request here.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie am Einstiegspunkt GeoAccessor.from_table und vergleichen Sie dessen aktuellen TableToNumPyArray-Pfad mit dem gezeigten arcpy.da.SearchCursor-Ansatz. Ermitteln Sie, ob ein Parameter hinzugefügt oder der Standard geändert werden sollte, und überprüfen Sie anschließend, dass die Tabellenkonvertierung die erwarteten pandas nullable dtypes beibehält, ohne bestehende Optionen wie skip_nulls und null_value zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
pandas, python
Bereich
data
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.