Skip to content

Commit 2e587e3

Browse files
committed
avoid verify_integrity warnings
1 parent 4d7c9e2 commit 2e587e3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ def _new_DatetimeIndex(cls, d):
4949
# so need to localize
5050
tz = d.pop('tz', None)
5151

52-
result = cls.__new__(cls, verify_integrity=False, **d)
52+
with warnings.catch_warnings():
53+
# we ignore warnings from passing verify_integrity=False
54+
# TODO: If we knew what was going in to **d, we might be able to
55+
# go through _simple_new instead
56+
warnings.simplefilter("ignore")
57+
result = cls.__new__(cls, verify_integrity=False, **d)
58+
5359
if tz is not None:
5460
result = result.tz_localize('UTC').tz_convert(tz)
5561
return result
@@ -569,8 +575,9 @@ def snap(self, freq='S'):
569575
snapped[i] = s
570576

571577
# we know it conforms; skip check
572-
return DatetimeIndex(snapped, freq=freq, verify_integrity=False)
578+
return DatetimeIndex._simple_new(snapped, freq=freq)
573579
# TODO: what about self.name? if so, use shallow_copy?
580+
# TODO: What about tz?
574581

575582
def unique(self, level=None):
576583
if level is not None:

0 commit comments

Comments
 (0)