From 66160f9df02a8a52011813517623f8e3962cc95c Mon Sep 17 00:00:00 2001 From: gfyoung Date: Sat, 21 May 2016 02:06:56 +0100 Subject: [PATCH] Reverse numpy compat changes to tslib.pyx Caused test failures on numpy master that were not worthwhile to address, so the changes were reverted. --- doc/source/whatsnew/v0.18.2.txt | 1 - pandas/tseries/tests/test_tslib.py | 14 ++------------ pandas/tslib.pyx | 4 +--- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/doc/source/whatsnew/v0.18.2.txt b/doc/source/whatsnew/v0.18.2.txt index 907ca6f185e0a..5b4a4981ab8ad 100644 --- a/doc/source/whatsnew/v0.18.2.txt +++ b/doc/source/whatsnew/v0.18.2.txt @@ -54,7 +54,6 @@ API changes - 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`) -- Compat with ``np.round`` and timestamps (:issue:`12811`) - An ``UnsupportedFunctionCall`` error is now raised if numpy ufuncs like ``np.mean`` are called on groupby or resample objects (:issue:`12811`) .. _whatsnew_0182.api.tolist: diff --git a/pandas/tseries/tests/test_tslib.py b/pandas/tseries/tests/test_tslib.py index bf546bd9d1a7e..8414a5ed42991 100644 --- a/pandas/tseries/tests/test_tslib.py +++ b/pandas/tseries/tests/test_tslib.py @@ -1337,14 +1337,11 @@ def test_shift_months(self): tm.assert_index_equal(actual, expected) def test_round(self): - # see gh-12811 stamp = Timestamp('2000-01-05 05:09:15.13') def _check_round(freq, expected): result = stamp.round(freq=freq) - npResult = np.round(stamp, freq) self.assertEqual(result, expected) - self.assertEqual(npResult, expected) for freq, expected in [ ('D', Timestamp('2000-01-05 00:00:00')), @@ -1353,16 +1350,9 @@ def _check_round(freq, expected): ]: _check_round(freq, expected) - msg = "the 'out' parameter is not supported" - tm.assertRaisesRegexp(ValueError, msg, np.round, - stamp, 'D', out=[]) - - # 'freq' is a required parameter, so we cannot - # assign a default should the user accidentally - # assign a 'decimals' input instead msg = "Could not evaluate" - tm.assertRaisesRegexp(ValueError, msg, np.round, - stamp, 2) + tm.assertRaisesRegexp(ValueError, msg, + stamp.round, 'foo') class TestTimestampOps(tm.TestCase): diff --git a/pandas/tslib.pyx b/pandas/tslib.pyx index 6c6707121c24a..f5301d3746e8b 100644 --- a/pandas/tslib.pyx +++ b/pandas/tslib.pyx @@ -387,7 +387,7 @@ class Timestamp(_Timestamp): result = result.tz_localize(self.tz) return result - def round(self, freq, *args, **kwargs): + def round(self, freq): """ Round the Timestamp to the specified resolution @@ -403,8 +403,6 @@ class Timestamp(_Timestamp): ------ ValueError if the freq cannot be converted """ - from pandas.compat.numpy.function import validate_round - validate_round(args, kwargs) return self._round(freq, np.round) def floor(self, freq):