Skip to content
This repository was archived by the owner on Oct 15, 2022. It is now read-only.
This repository was archived by the owner on Oct 15, 2022. It is now read-only.

Lesson 5: grid.replace() fails with geometry data #14

@muxevola

Description

@muxevola

The following code:

# Replace No Data values (-1) with large number (999)
grid = grid.replace(-1, 999)

Fails with the below error:

TypeError: Value should be either a BaseGeometry or None, got 999

Replaced with the below code, which limits the change to the first 14 columns (i.e. geometry column excluded):

for col in grid.columns[:14]:
    grid[col].replace(-1, 999, inplace=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions