Skip to content

Commit b5273f8

Browse files
committed
strip out period validation
1 parent 9babc8b commit b5273f8

File tree

2 files changed

+1
-19
lines changed

2 files changed

+1
-19
lines changed

pandas/tests/types/test_missing.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,6 @@ def test_valid_fill_value(value, dtype):
322322
assert valid_fill_value(value, dtype)
323323

324324

325-
@pytest.mark.parametrize('value',
326-
[pd.Period('1970-01-01'), np.nan])
327-
def test_valid_period_fill_value(value):
328-
assert valid_fill_value(value, 'O', is_period=True)
329-
330-
331325
@pytest.mark.parametrize(('value', 'dtype'),
332326
[(0, bool), (0.0, bool), (0j, bool), ('0', bool),
333327
('0', int),
@@ -341,9 +335,3 @@ def test_valid_period_fill_value(value):
341335
(pd.Period('1970-01-01'), np.dtype('timedelta64'))])
342336
def test_invalid_fill_value(value, dtype):
343337
assert not valid_fill_value(value, dtype)
344-
345-
346-
@pytest.mark.parametrize('value',
347-
[datetime(1970, 1, 1), timedelta(0)])
348-
def test_invalid_period_fill_value(value):
349-
assert not valid_fill_value(value, 'O', is_period=True)

pandas/types/missing.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,18 +396,14 @@ def na_value_for_dtype(dtype):
396396
return np.nan
397397

398398

399-
def valid_fill_value(value, dtype, is_period=False):
399+
def valid_fill_value(value, dtype):
400400
"""
401401
Makes sure the fill value is appropriate for the given dtype.
402402
403403
Parameters
404404
----------
405405
value : scalar
406406
dtype: string / dtype
407-
is_period : bool
408-
Period-type columns retain a numpy 'O' dtype, but we still want to
409-
potentially restrict their contents to period types only. To implement
410-
this we pass whether or not a column consists of periods separately.
411407
"""
412408
if not is_scalar(value):
413409
# maybe always raise?
@@ -424,6 +420,4 @@ def valid_fill_value(value, dtype, is_period=False):
424420
return isinstance(value, (np.datetime64, datetime))
425421
elif is_timedelta64_dtype(dtype):
426422
return isinstance(value, (np.timedelta64, timedelta))
427-
elif is_period:
428-
return is_period_arraylike(np.array([value]))
429423
return True

0 commit comments

Comments
 (0)