Skip to content

Commit f5c24d2

Browse files
gfyoungjreback
authored andcommitted
Reverse numpy compat changes to tslib.pyx
Title is self-explanatory. xref #13148. Author: gfyoung <[email protected]> Closes #13246 from gfyoung/tslib-compat-undo and squashes the following commits: 66160f9 [gfyoung] Reverse numpy compat changes to tslib.pyx
1 parent 8e2f70b commit f5c24d2

File tree

3 files changed

+3
-16
lines changed

3 files changed

+3
-16
lines changed

doc/source/whatsnew/v0.18.2.txt

-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ API changes
5454

5555

5656
- Non-convertible dates in an excel date column will be returned without conversion and the column will be ``object`` dtype, rather than raising an exception (:issue:`10001`)
57-
- Compat with ``np.round`` and timestamps (:issue:`12811`)
5857
- An ``UnsupportedFunctionCall`` error is now raised if numpy ufuncs like ``np.mean`` are called on groupby or resample objects (:issue:`12811`)
5958

6059
.. _whatsnew_0182.api.tolist:

pandas/tseries/tests/test_tslib.py

+2-12
Original file line numberDiff line numberDiff line change
@@ -1337,14 +1337,11 @@ def test_shift_months(self):
13371337
tm.assert_index_equal(actual, expected)
13381338

13391339
def test_round(self):
1340-
# see gh-12811
13411340
stamp = Timestamp('2000-01-05 05:09:15.13')
13421341

13431342
def _check_round(freq, expected):
13441343
result = stamp.round(freq=freq)
1345-
npResult = np.round(stamp, freq)
13461344
self.assertEqual(result, expected)
1347-
self.assertEqual(npResult, expected)
13481345

13491346
for freq, expected in [
13501347
('D', Timestamp('2000-01-05 00:00:00')),
@@ -1353,16 +1350,9 @@ def _check_round(freq, expected):
13531350
]:
13541351
_check_round(freq, expected)
13551352

1356-
msg = "the 'out' parameter is not supported"
1357-
tm.assertRaisesRegexp(ValueError, msg, np.round,
1358-
stamp, 'D', out=[])
1359-
1360-
# 'freq' is a required parameter, so we cannot
1361-
# assign a default should the user accidentally
1362-
# assign a 'decimals' input instead
13631353
msg = "Could not evaluate"
1364-
tm.assertRaisesRegexp(ValueError, msg, np.round,
1365-
stamp, 2)
1354+
tm.assertRaisesRegexp(ValueError, msg,
1355+
stamp.round, 'foo')
13661356

13671357

13681358
class TestTimestampOps(tm.TestCase):

pandas/tslib.pyx

+1-3
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class Timestamp(_Timestamp):
387387
result = result.tz_localize(self.tz)
388388
return result
389389

390-
def round(self, freq, *args, **kwargs):
390+
def round(self, freq):
391391
"""
392392
Round the Timestamp to the specified resolution
393393
@@ -403,8 +403,6 @@ class Timestamp(_Timestamp):
403403
------
404404
ValueError if the freq cannot be converted
405405
"""
406-
from pandas.compat.numpy.function import validate_round
407-
validate_round(args, kwargs)
408406
return self._round(freq, np.round)
409407

410408
def floor(self, freq):

0 commit comments

Comments
 (0)