timeseries_shaper.filter.numeric_filter
1import pandas as pd 2from ..base import Base 3 4class IntegerFilter(Base): 5 """ 6 Provides class methods for filtering integer columns in a pandas DataFrame. 7 """ 8 9 @classmethod 10 def filter_value_integer_match(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pd.DataFrame: 11 """Filters rows where 'value_integer' matches the specified integer.""" 12 return dataframe[dataframe[column_name] == integer_value] 13 14 @classmethod 15 def filter_value_integer_not_match(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pd.DataFrame: 16 """Filters rows where 'value_integer' does not match the specified integer.""" 17 return dataframe[dataframe[column_name] != integer_value] 18 19 @classmethod 20 def filter_value_integer_between(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', min_value: int = 0, max_value: int = 100) -> pd.DataFrame: 21 """Filters rows where 'value_integer' is between the specified min and max values (inclusive).""" 22 return dataframe[(dataframe[column_name] >= min_value) & (dataframe[column_name] <= max_value)] 23 24 25class DoubleFilter(Base): 26 """ 27 Provides class methods for filtering double (floating-point) columns in a pandas DataFrame, 28 particularly focusing on NaN values. 29 """ 30 31 @classmethod 32 def filter_nan_value_double(cls, dataframe: pd.DataFrame, column_name: str = 'value_double') -> pd.DataFrame: 33 """Filters out rows where 'value_double' is NaN.""" 34 return dataframe[dataframe[column_name].notna()] 35 36 @classmethod 37 def filter_value_double_between(cls, dataframe: pd.DataFrame, column_name: str = 'value_double', min_value: float = 0.0, max_value: float = 100.0) -> pd.DataFrame: 38 """Filters rows where 'value_double' is between the specified min and max values (inclusive).""" 39 return dataframe[(dataframe[column_name] >= min_value) & (dataframe[column_name] <= max_value)]
class
IntegerFilter(timeseries_shaper.base.Base):
5class IntegerFilter(Base): 6 """ 7 Provides class methods for filtering integer columns in a pandas DataFrame. 8 """ 9 10 @classmethod 11 def filter_value_integer_match(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pd.DataFrame: 12 """Filters rows where 'value_integer' matches the specified integer.""" 13 return dataframe[dataframe[column_name] == integer_value] 14 15 @classmethod 16 def filter_value_integer_not_match(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pd.DataFrame: 17 """Filters rows where 'value_integer' does not match the specified integer.""" 18 return dataframe[dataframe[column_name] != integer_value] 19 20 @classmethod 21 def filter_value_integer_between(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', min_value: int = 0, max_value: int = 100) -> pd.DataFrame: 22 """Filters rows where 'value_integer' is between the specified min and max values (inclusive).""" 23 return dataframe[(dataframe[column_name] >= min_value) & (dataframe[column_name] <= max_value)]
Provides class methods for filtering integer columns in a pandas DataFrame.
@classmethod
def
filter_value_integer_match( cls, dataframe: pandas.core.frame.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pandas.core.frame.DataFrame:
10 @classmethod 11 def filter_value_integer_match(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pd.DataFrame: 12 """Filters rows where 'value_integer' matches the specified integer.""" 13 return dataframe[dataframe[column_name] == integer_value]
Filters rows where 'value_integer' matches the specified integer.
@classmethod
def
filter_value_integer_not_match( cls, dataframe: pandas.core.frame.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pandas.core.frame.DataFrame:
15 @classmethod 16 def filter_value_integer_not_match(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', integer_value: int = 0) -> pd.DataFrame: 17 """Filters rows where 'value_integer' does not match the specified integer.""" 18 return dataframe[dataframe[column_name] != integer_value]
Filters rows where 'value_integer' does not match the specified integer.
@classmethod
def
filter_value_integer_between( cls, dataframe: pandas.core.frame.DataFrame, column_name: str = 'value_integer', min_value: int = 0, max_value: int = 100) -> pandas.core.frame.DataFrame:
20 @classmethod 21 def filter_value_integer_between(cls, dataframe: pd.DataFrame, column_name: str = 'value_integer', min_value: int = 0, max_value: int = 100) -> pd.DataFrame: 22 """Filters rows where 'value_integer' is between the specified min and max values (inclusive).""" 23 return dataframe[(dataframe[column_name] >= min_value) & (dataframe[column_name] <= max_value)]
Filters rows where 'value_integer' is between the specified min and max values (inclusive).
Inherited Members
- timeseries_shaper.base.Base
- Base
- dataframe
- get_dataframe
class
DoubleFilter(timeseries_shaper.base.Base):
26class DoubleFilter(Base): 27 """ 28 Provides class methods for filtering double (floating-point) columns in a pandas DataFrame, 29 particularly focusing on NaN values. 30 """ 31 32 @classmethod 33 def filter_nan_value_double(cls, dataframe: pd.DataFrame, column_name: str = 'value_double') -> pd.DataFrame: 34 """Filters out rows where 'value_double' is NaN.""" 35 return dataframe[dataframe[column_name].notna()] 36 37 @classmethod 38 def filter_value_double_between(cls, dataframe: pd.DataFrame, column_name: str = 'value_double', min_value: float = 0.0, max_value: float = 100.0) -> pd.DataFrame: 39 """Filters rows where 'value_double' is between the specified min and max values (inclusive).""" 40 return dataframe[(dataframe[column_name] >= min_value) & (dataframe[column_name] <= max_value)]
Provides class methods for filtering double (floating-point) columns in a pandas DataFrame, particularly focusing on NaN values.
@classmethod
def
filter_nan_value_double( cls, dataframe: pandas.core.frame.DataFrame, column_name: str = 'value_double') -> pandas.core.frame.DataFrame:
32 @classmethod 33 def filter_nan_value_double(cls, dataframe: pd.DataFrame, column_name: str = 'value_double') -> pd.DataFrame: 34 """Filters out rows where 'value_double' is NaN.""" 35 return dataframe[dataframe[column_name].notna()]
Filters out rows where 'value_double' is NaN.
@classmethod
def
filter_value_double_between( cls, dataframe: pandas.core.frame.DataFrame, column_name: str = 'value_double', min_value: float = 0.0, max_value: float = 100.0) -> pandas.core.frame.DataFrame:
37 @classmethod 38 def filter_value_double_between(cls, dataframe: pd.DataFrame, column_name: str = 'value_double', min_value: float = 0.0, max_value: float = 100.0) -> pd.DataFrame: 39 """Filters rows where 'value_double' is between the specified min and max values (inclusive).""" 40 return dataframe[(dataframe[column_name] >= min_value) & (dataframe[column_name] <= max_value)]
Filters rows where 'value_double' is between the specified min and max values (inclusive).
Inherited Members
- timeseries_shaper.base.Base
- Base
- dataframe
- get_dataframe