From fc9423874fddf2e4a291502dfd0ad850506629d1 Mon Sep 17 00:00:00 2001 From: mansenfranzen Date: Sat, 16 Mar 2019 15:16:10 +0100 Subject: [PATCH] Mark `_BaseIntervalIdentifier` as private and add `NotImplementedError` for `_transform`. --- .../wranglers/pandas/interval_identifier.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pywrangler/wranglers/pandas/interval_identifier.py b/src/pywrangler/wranglers/pandas/interval_identifier.py index 10b75b5..74b1dfa 100644 --- a/src/pywrangler/wranglers/pandas/interval_identifier.py +++ b/src/pywrangler/wranglers/pandas/interval_identifier.py @@ -10,7 +10,7 @@ from pywrangler.wranglers.pandas.base import PandasSingleNoFit -class BaseIntervalIdentifier(PandasSingleNoFit, IntervalIdentifier): +class _BaseIntervalIdentifier(PandasSingleNoFit, IntervalIdentifier): """Provides `transform` and `validate_input` methods common to more than one implementation of the pandas interval identification wrangler. @@ -70,8 +70,15 @@ def transform(self, df: pd.DataFrame) -> pd.DataFrame: return df_result + def _transform(self, series: pd.Series) -> List[int]: + """Needs to be implemented. + + """ + + raise NotImplementedError + -class NaiveIterator(BaseIntervalIdentifier): +class NaiveIterator(_BaseIntervalIdentifier): """Most simple, sequential implementation which iterates values while remembering the state of start and end markers. @@ -157,7 +164,7 @@ def is_valid_end(value, active): return result -class VectorizedCumSum(BaseIntervalIdentifier): +class VectorizedCumSum(_BaseIntervalIdentifier): """Sophisticated approach using multiple, vectorized operations. Using cumulative sum allows enumeration of intervals to avoid looping.