From ce929d23ffac407df0efded9cfceba180dc7aae9 Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Thu, 26 Aug 2021 05:04:17 +0000 Subject: [PATCH 1/7] added env to gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 2c337be60e94e..441f63e19adc9 100644 --- a/.gitignore +++ b/.gitignore @@ -120,3 +120,7 @@ doc/build/html/index.html doc/tmp.sv env/ doc/source/savefig/ + + +# venv by me +/myenv \ No newline at end of file From 1479fad15981e9c6ffa8ffade33007e15a871ad4 Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Thu, 16 Sep 2021 12:21:24 +0000 Subject: [PATCH 2/7] generic.py modified --- pandas/core/generic.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index e171ded654989..05628e3a30b50 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -7727,12 +7727,7 @@ def between_time( # On arg removal inclusive can default to "both" inclusive = "both" left_inclusive, right_inclusive = validate_inclusive(inclusive) - indexer = index.indexer_between_time( - start_time, - end_time, - include_start=left_inclusive, - include_end=right_inclusive, - ) + indexer = index.indexer_between_time(start_time, end_time, inclusive) return self._take_with_is_copy(indexer, axis=axis) @doc(**_shared_doc_kwargs) From eac7f0c64253cdb79834aade8c1ad0ff605055db Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Thu, 16 Sep 2021 12:26:36 +0000 Subject: [PATCH 3/7] datetimes.py modified --- pandas/core/indexes/datetimes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index fbbe6606ba522..a9c93c3fc6ebc 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -822,7 +822,7 @@ def indexer_at_time(self, time, asof: bool = False) -> npt.NDArray[np.intp]: return (time_micros == micros).nonzero()[0] def indexer_between_time( - self, start_time, end_time, include_start: bool = True, include_end: bool = True + self, start_time, end_time, inclusive="both" ) -> npt.NDArray[np.intp]: """ Return index locations of values between particular times of day @@ -852,12 +852,12 @@ def indexer_between_time( start_micros = _time_to_micros(start_time) end_micros = _time_to_micros(end_time) - if include_start and include_end: + if inclusive == "both": lop = rop = operator.le - elif include_start: + elif inclusive == "left": lop = operator.le rop = operator.lt - elif include_end: + elif inclusive == "right": lop = operator.lt rop = operator.le else: From 022a3475de0cd6f12c0d27fe414e20b555222553 Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Thu, 16 Sep 2021 12:45:51 +0000 Subject: [PATCH 4/7] redundant line removed from generic.py --- pandas/core/generic.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 05628e3a30b50..76b39e26eaa3f 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -72,7 +72,6 @@ validate_ascending, validate_bool_kwarg, validate_fillna_kwargs, - validate_inclusive, ) from pandas.core.dtypes.common import ( @@ -7726,7 +7725,6 @@ def between_time( elif inclusive is None: # On arg removal inclusive can default to "both" inclusive = "both" - left_inclusive, right_inclusive = validate_inclusive(inclusive) indexer = index.indexer_between_time(start_time, end_time, inclusive) return self._take_with_is_copy(indexer, axis=axis) From ccd7a97e04344ec1f1467120c5c9a8c03867e145 Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Thu, 16 Sep 2021 13:01:54 +0000 Subject: [PATCH 5/7] removed env from gitignore --- .gitignore | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.gitignore b/.gitignore index 441f63e19adc9..2c337be60e94e 100644 --- a/.gitignore +++ b/.gitignore @@ -120,7 +120,3 @@ doc/build/html/index.html doc/tmp.sv env/ doc/source/savefig/ - - -# venv by me -/myenv \ No newline at end of file From dd8a15ca8a3ca8170621b8f22be0ecb370d0e415 Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Tue, 21 Sep 2021 13:12:29 +0000 Subject: [PATCH 6/7] whatsnew deprecation entry made --- doc/source/whatsnew/v1.4.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/whatsnew/v1.4.0.rst b/doc/source/whatsnew/v1.4.0.rst index eb1bc270a7d1b..6b46d111b9b19 100644 --- a/doc/source/whatsnew/v1.4.0.rst +++ b/doc/source/whatsnew/v1.4.0.rst @@ -334,6 +334,7 @@ Other Deprecations - Deprecated the 'include_start' and 'include_end' arguments in :meth:`DataFrame.between_time`; in a future version passing 'include_start' or 'include_end' will raise (:issue:`40245`) - Deprecated the ``squeeze`` argument to :meth:`read_csv`, :meth:`read_table`, and :meth:`read_excel`. Users should squeeze the DataFrame afterwards with ``.squeeze("columns")`` instead. (:issue:`43242`) - Deprecated the ``index`` argument to :class:`SparseArray` construction (:issue:`23089`) +- Deprecated the 'include_start' and 'include_end' arguments in :meth:`DatetimeIndex.indexer_between_time`; in a future version passing 'include_start' or 'include_end' will raise (:issue:`43602`) - .. --------------------------------------------------------------------------- From 8f1399caced686ec11ccc019928541c819f328dc Mon Sep 17 00:00:00 2001 From: Suyash Gupta Date: Tue, 21 Sep 2021 13:19:49 +0000 Subject: [PATCH 7/7] indexer_between_time docstring modified --- pandas/core/indexes/datetimes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index a9c93c3fc6ebc..67fa86c7bff35 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -834,8 +834,8 @@ def indexer_between_time( Time passed either as object (datetime.time) or as string in appropriate format ("%H:%M", "%H%M", "%I:%M%p", "%I%M%p", "%H:%M:%S", "%H%M%S", "%I:%M:%S%p","%I%M%S%p"). - include_start : bool, default True - include_end : bool, default True + inclusive : {"both", "neither", "left", "right"}, default "both" + Include boundaries; whether to set each bound as closed or open. Returns -------