Skip to content

Commit e947e4d

Browse files
committed
update imports of normalize_date
1 parent bd9a3e0 commit e947e4d

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)
58-
from pandas._libs.tslibs import (timezones, conversion, fields,
57+
from pandas._libs.tslibs import (timezones, conversion, fields, parsing,
5958
period as libperiod)
6059

6160
# -------- some conversion wrapper functions
@@ -524,14 +523,14 @@ def _generate(cls, start, end, periods, name, offset,
524523

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

532531
if end is not None:
533532
if normalize:
534-
end = normalize_date(end)
533+
end = libts.normalize_date(end)
535534
_normalized = True
536535
else:
537536
_normalized = _normalized and end.time() == _midnight
@@ -1529,7 +1528,7 @@ def _maybe_cast_slice_bound(self, label, side, kind):
15291528
if isinstance(label, compat.string_types):
15301529
freq = getattr(self, 'freqstr',
15311530
getattr(self, 'inferred_freq', None))
1532-
_, parsed, reso = parse_time_string(label, freq)
1531+
_, parsed, reso = parsing.parse_time_string(label, freq)
15331532
lower, upper = self._parsed_string_to_bounds(reso, parsed)
15341533
# lower, upper form the half-open interval:
15351534
# [parsed, parsed + 1 freq)
@@ -1546,7 +1545,7 @@ def _maybe_cast_slice_bound(self, label, side, kind):
15461545
def _get_string_slice(self, key, use_lhs=True, use_rhs=True):
15471546
freq = getattr(self, 'freqstr',
15481547
getattr(self, 'inferred_freq', None))
1549-
_, parsed, reso = parse_time_string(key, freq)
1548+
_, parsed, reso = parsing.parse_time_string(key, freq)
15501549
loc = self._partial_date_slice(reso, parsed, use_lhs=use_lhs,
15511550
use_rhs=use_rhs)
15521551
return loc
@@ -1965,8 +1964,8 @@ def indexer_between_time(self, start_time, end_time, include_start=True,
19651964
-------
19661965
values_between_time : TimeSeries
19671966
"""
1968-
start_time = to_time(start_time)
1969-
end_time = to_time(end_time)
1967+
start_time = tools.to_time(start_time)
1968+
end_time = tools.to_time(end_time)
19701969
time_micros = self._get_time_micros()
19711970
start_micros = _time_to_micros(start_time)
19721971
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)