-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed dropping the geometry column (#322)
- Loading branch information
1 parent
105bfd6
commit b8b6c79
Showing
5 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from typing import Literal | ||
|
||
import dask.dataframe.dask_expr as dx | ||
|
||
import geopandas | ||
|
||
|
||
def _drop(df: geopandas.GeoDataFrame, columns, errors): | ||
return df.drop(columns=columns, errors=errors) | ||
|
||
|
||
def _validate_axis(axis=0, none_is_zero: bool = True) -> None | Literal[0, 1]: | ||
if axis not in (0, 1, "index", "columns", None): | ||
raise ValueError(f"No axis named {axis}") | ||
# convert to numeric axis | ||
numeric_axis: dict[str | None, Literal[0, 1]] = {"index": 0, "columns": 1} | ||
if none_is_zero: | ||
numeric_axis[None] = 0 | ||
|
||
return numeric_axis.get(axis, axis) | ||
|
||
|
||
class Drop(dx.expr.Drop): | ||
operation = staticmethod(_drop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters