Skip to content

Pandas integration does not symmetrically store and load with feather format #44

@EternalDeiwos

Description

@EternalDeiwos

I am playing around with the geoarrow.pandas integration and found something odd; if I load a data frame containing a geometry column it will successfully load and display the geometry correctly but I am unable able to do anything with it. Anything I try (e.g. df.geometry.geoarrow.*) produces the following error:

TypeError: Can't create geoarrow.array from Arrow array of type None

I created the file like this:

import geoarrow.pyarrow as ga
import geoarrow.pandas as _
import pandas as pd
import numpy as np

points = np.random.rand((1 << 20, 2))

df = pd.DataFrame({
    "geometry": ga.point().from_geobuffers(
        None,
        points[:, 0],
        points[:, 1]
    )
})

df.to_feather('points.feather')

and I load the file like this

import geoarrow.pyarrow as ga
import geoarrow.pandas as _
import pandas as pd

df = pd.read_feather("points.feather")

# Example operations that produce the above error
df.astype({ 'geometry': 'geoarrow.wkt' })
x, y = df.geometry.geoarrow.point_coords()
# etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions