Skip to content

Commit e70e75a

Browse files
committed
use tzinfo=object to accept None as a default parameter
1 parent 52b6c2c commit e70e75a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

doc/source/whatsnew/v0.20.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ Performance Improvements
416416
Bug Fixes
417417
~~~~~~~~~
418418

419-
- Bug in ``Timestamp.replace`` exception ValueError raised when wrong argument name given, should be TypeError (:issue:`15240`)
419+
- Bug in ``Timestamp.replace`` now raises ``TypeError`` when incorrect argument names are given; previously this raised ``ValueError`` (:issue:`15240`)
420420
- Bug in ``Index`` power operations with reversed operands (:issue:`14973`)
421421
- Bug in ``TimedeltaIndex`` addition where overflow was being allowed without error (:issue:`14816`)
422422
- Bug in ``TimedeltaIndex`` raising a ``ValueError`` when boolean indexing with ``loc`` (:issue:`14946`)

pandas/tseries/tests/test_timezones.py

-1
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,6 @@ def test_date_range_span_dst_transition(self):
826826
def test_convert_datetime_list(self):
827827
dr = date_range('2012-06-02', periods=10,
828828
tz=self.tzstr('US/Eastern'), name='foo')
829-
830829
dr2 = DatetimeIndex(list(dr), name='foo')
831830
self.assert_index_equal(dr, dr2)
832831
self.assertEqual(dr.tz, dr2.tz)

pandas/tslib.pyx

+4-3
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ class Timestamp(_Timestamp):
652652

653653
def replace(self, year=None, month=None, day=None,
654654
hour=None, minute=None, second=None, microsecond=None, nanosecond=None,
655-
tzinfo=None):
655+
tzinfo=object, fold=0):
656656
"""
657657
implements datetime.replace, handles nanoseconds
658658
@@ -667,6 +667,8 @@ class Timestamp(_Timestamp):
667667
microsecond : int, optional
668668
nanosecond: int, optional
669669
tzinfo : tz-convertible, optional
670+
fold : int, optional, default is 0
671+
added in 3.6, NotImplemented
670672
671673
Returns
672674
-------
@@ -713,7 +715,7 @@ class Timestamp(_Timestamp):
713715
dts.us = validate('microsecond', microsecond)
714716
if nanosecond is not None:
715717
dts.ps = validate('nanosecond', nanosecond) * 1000
716-
if tzinfo is not None:
718+
if tzinfo is not object:
717719
_tzinfo = tzinfo
718720

719721
# reconstruct & check bounds
@@ -726,7 +728,6 @@ class Timestamp(_Timestamp):
726728
value = tz_convert_single(value, _tzinfo, 'UTC')
727729

728730
result = create_timestamp_from_ts(value, dts, _tzinfo, self.freq)
729-
730731
return result
731732

732733
def isoformat(self, sep='T'):

0 commit comments

Comments
 (0)