Skip to content

GeoAccessor.from_table add parameter to avoid using TableToNumPyArray #1733

Open
@hildermesmedeiros

Description

@hildermesmedeiros

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions