Skip to content

Commit ea51437

Browse files
committed
Made this code clearer.
1 parent 2466ecb commit ea51437

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pandas/tseries/index.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1293,12 +1293,11 @@ def _parsed_string_to_bounds(self, reso, parsed):
12931293

12941294
def _partial_date_slice(self, reso, parsed, use_lhs=True, use_rhs=True):
12951295
is_monotonic = self.is_monotonic
1296-
if ((reso in ['day', 'hour', 'minute'] and
1297-
not (self._resolution < Resolution.get_reso(reso) or
1298-
not is_monotonic)) or
1299-
(reso == 'second' and
1300-
not (self._resolution <= Resolution.RESO_SEC or
1301-
not is_monotonic))):
1296+
if (is_monotonic
1297+
and ((reso in ['day', 'hour', 'minute']
1298+
and self._resolution >= Resolution.get_reso(reso))
1299+
or (reso == 'second'
1300+
and self._resolution > Resolution.RESO_SEC))):
13021301
# These resolution/monotonicity validations came from GH3931,
13031302
# GH3452 and GH2369.
13041303
raise KeyError

0 commit comments

Comments
 (0)