From 5d93c8cfca0bb5101ac7b02f4e058298725d757f Mon Sep 17 00:00:00 2001 From: Niko Aarnio Date: Wed, 18 Sep 2024 10:10:08 +0300 Subject: [PATCH] fix: fix type hint from float to Number --- .../exploratory_analyses/descriptive_statistics.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/eis_toolkit/exploratory_analyses/descriptive_statistics.py b/eis_toolkit/exploratory_analyses/descriptive_statistics.py index e0da06f5..9830d91b 100644 --- a/eis_toolkit/exploratory_analyses/descriptive_statistics.py +++ b/eis_toolkit/exploratory_analyses/descriptive_statistics.py @@ -1,3 +1,5 @@ +from numbers import Number + import geopandas as gpd import numpy as np import pandas as pd @@ -10,7 +12,9 @@ from eis_toolkit.exceptions import InvalidColumnException, InvalidRasterBandException -def _descriptive_statistics(data: Union[rasterio.io.DatasetReader, pd.DataFrame, gpd.GeoDataFrame]) -> Dict[str, float]: +def _descriptive_statistics( + data: Union[rasterio.io.DatasetReader, pd.DataFrame, gpd.GeoDataFrame] +) -> Dict[str, Number]: statistics = DescrStatsW(data) min = np.min(data) max = np.max(data) @@ -69,7 +73,7 @@ def descriptive_statistics_dataframe( @beartype -def descriptive_statistics_raster(input_data: rasterio.io.DatasetReader, band: int = 1) -> Dict[str, float]: +def descriptive_statistics_raster(input_data: rasterio.io.DatasetReader, band: int = 1) -> Dict[str, Number]: """Compute descriptive statistics from raster data. Computes the following statistics: