From da568c6349e48ae216ef85e367b99d54eb6637e3 Mon Sep 17 00:00:00 2001 From: Sharon Fitzpatrick Date: Tue, 26 Mar 2024 15:33:35 -0700 Subject: [PATCH] #206 address deprecation warning in shoreline.py concat empty dataframes --- src/coastseg/shoreline.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/coastseg/shoreline.py b/src/coastseg/shoreline.py index a79b7ba1..0af9e0ba 100644 --- a/src/coastseg/shoreline.py +++ b/src/coastseg/shoreline.py @@ -17,6 +17,7 @@ # External dependencies imports import geopandas as gpd +import pandas as pd from pandas import concat # from fiona.errors import DriverError @@ -301,7 +302,12 @@ def create_geodataframe( self.get_clipped_shoreline(file, bbox, columns_to_keep) for file in shoreline_files ] - shorelines_gdf = concat(shorelines, ignore_index=True) + # shorelines_gdf = concat(shorelines, ignore_index=True) + # Drop columns where all values are NA + shorelines = [df.dropna(axis=1, how='all') for df in shorelines] + + # Concatenate the DataFrames + shorelines_gdf = pd.concat(shorelines, ignore_index=True) # clean the shoreline geodataframe shorelines_gdf = self.preprocess_service(shorelines_gdf, columns_to_keep) validate_geometry_types(