Skip to content

Commit 972cf0d

Browse files
committed
update imports of normalize_date
1 parent 32f562d commit 972cf0d

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
DatelikeOps, TimelikeOps, DatetimeIndexOpsMixin)
4444
from pandas.tseries.offsets import (
4545
DateOffset, generate_range, Tick, CDay, prefix_mapping)
46-
from pandas.core.tools.datetimes import (
47-
parse_time_string, normalize_date, to_time)
46+
4847
from pandas.core.tools.timedeltas import to_timedelta
4948
from pandas.util._decorators import (Appender, cache_readonly,
5049
deprecate_kwarg, Substitution)
@@ -55,7 +54,7 @@
5554
from pandas._libs import (lib, index as libindex, tslib as libts,
5655
algos as libalgos, join as libjoin,
5756
Timestamp, period as libperiod)
58-
from pandas._libs.tslibs import timezones, conversion, fields
57+
from pandas._libs.tslibs import timezones, conversion, fields, parsing
5958

6059
# -------- some conversion wrapper functions
6160

@@ -523,14 +522,14 @@ def _generate(cls, start, end, periods, name, offset,
523522

524523
if start is not None:
525524
if normalize:
526-
start = normalize_date(start)
525+
start = libts.normalize_date(start)
527526
_normalized = True
528527
else:
529528
_normalized = _normalized and start.time() == _midnight
530529

531530
if end is not None:
532531
if normalize:
533-
end = normalize_date(end)
532+
end = libts.normalize_date(end)
534533
_normalized = True
535534
else:
536535
_normalized = _normalized and end.time() == _midnight
@@ -1539,7 +1538,7 @@ def _maybe_cast_slice_bound(self, label, side, kind):
15391538
if isinstance(label, compat.string_types):
15401539
freq = getattr(self, 'freqstr',
15411540
getattr(self, 'inferred_freq', None))
1542-
_, parsed, reso = parse_time_string(label, freq)
1541+
_, parsed, reso = parsing.parse_time_string(label, freq)
15431542
lower, upper = self._parsed_string_to_bounds(reso, parsed)
15441543
# lower, upper form the half-open interval:
15451544
# [parsed, parsed + 1 freq)
@@ -1556,7 +1555,7 @@ def _maybe_cast_slice_bound(self, label, side, kind):
15561555
def _get_string_slice(self, key, use_lhs=True, use_rhs=True):
15571556
freq = getattr(self, 'freqstr',
15581557
getattr(self, 'inferred_freq', None))
1559-
_, parsed, reso = parse_time_string(key, freq)
1558+
_, parsed, reso = parsing.parse_time_string(key, freq)
15601559
loc = self._partial_date_slice(reso, parsed, use_lhs=use_lhs,
15611560
use_rhs=use_rhs)
15621561
return loc
@@ -1975,8 +1974,8 @@ def indexer_between_time(self, start_time, end_time, include_start=True,
19751974
-------
19761975
values_between_time : TimeSeries
19771976
"""
1978-
start_time = to_time(start_time)
1979-
end_time = to_time(end_time)
1977+
start_time = tools.to_time(start_time)
1978+
end_time = tools.to_time(end_time)
19801979
time_micros = self._get_time_micros()
19811980
start_micros = _time_to_micros(start_time)
19821981
end_micros = _time_to_micros(end_time)

pandas/core/tools/datetimes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,6 @@ def calc_with_mask(carg, mask):
629629
return None
630630

631631

632-
normalize_date = tslib.normalize_date
633-
634632
# Fixed time formats for time parsing
635633
_time_formats = ["%H:%M", "%H%M", "%I:%M%p", "%I%M%p",
636634
"%H:%M:%S", "%H%M%S", "%I:%M:%S%p", "%I%M%S%p"]

pandas/tests/indexes/datetimes/test_tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from pandas._libs import tslib
1717
from pandas._libs.tslibs import parsing
1818
from pandas.core.tools import datetimes as tools
19-
from pandas.core.tools.datetimes import normalize_date
19+
2020
from pandas.compat import lmap
2121
from pandas.compat.numpy import np_array_datetime64_compat
2222
from pandas.core.dtypes.common import is_datetime64_ns_dtype
@@ -1576,12 +1576,12 @@ def test_coerce_of_invalid_datetimes(self):
15761576
def test_normalize_date():
15771577
value = date(2012, 9, 7)
15781578

1579-
result = normalize_date(value)
1579+
result = tslib.normalize_date(value)
15801580
assert (result == datetime(2012, 9, 7))
15811581

15821582
value = datetime(2012, 9, 7, 12)
15831583

1584-
result = normalize_date(value)
1584+
result = tslib.normalize_date(value)
15851585
assert (result == datetime(2012, 9, 7))
15861586

15871587

pandas/tseries/offsets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import numpy as np
99

1010
from pandas.core.dtypes.generic import ABCSeries, ABCDatetimeIndex, ABCPeriod
11-
from pandas.core.tools.datetimes import to_datetime, normalize_date
11+
from pandas.core.tools.datetimes import to_datetime
1212
from pandas.core.common import AbstractMethodError
1313

1414
# import after tools, dateutil check
@@ -103,7 +103,7 @@ def wrapper(self, other):
103103

104104
if self.normalize:
105105
# normalize_date returns normal datetime
106-
result = normalize_date(result)
106+
result = tslib.normalize_date(result)
107107

108108
if tz is not None and result.tzinfo is None:
109109
result = tslib._localize_pydatetime(result, tz)

0 commit comments

Comments
 (0)