rok commented on a change in pull request #11818: URL: https://github.com/apache/arrow/pull/11818#discussion_r778301184
########## File path: python/pyarrow/tests/test_compute.py ########## @@ -1899,6 +1900,71 @@ def test_assume_timezone(): result.equals(pa.array(expected)) +def _check_temporal_rounding(ts, values, unit): + unit_shorthand = { + "nanosecond": "ns", + "microsecond": "us", + "millisecond": "L", + "second": "s", + "minute": "min", + "hour": "H", + "day": "D" + } + ta = pa.array(ts) + + for value in values: + frequency = str(value) + unit_shorthand[unit] + options = pc.RoundTemporalOptions(value, unit) + + result = pc.ceil_temporal(ta, options=options).to_pandas() + expected = ts.dt.ceil(frequency) + if unit != "nanosecond": + np.testing.assert_array_equal(result, expected) + + result = pc.floor_temporal(ta, options=options).to_pandas() + expected = ts.dt.floor(frequency) + np.testing.assert_array_equal(result, expected) + + result = pc.round_temporal(ta, options=options).to_pandas() + expected = ts.dt.round(frequency) + np.testing.assert_array_equal(result, expected) + + +# TODO: We should test on windows once ARROW-13168 is resolved. +@pytest.mark.skipif(sys.platform == 'win32', + reason="Timezone database is not available on Windows yet") +@pytest.mark.parametrize('unit', ("nanosecond", "microsecond", "millisecond", + "second", "minute", "hour", "day")) +@pytest.mark.pandas +def test_round_temporal(unit): + values = (1, 2, 3, 4, 5, 6, 7, 10, 15, 24, 60, 250, 500, 750) + timestamps = [ + # "1899-04-18 01:57:09.190202880", + # "1899-09-12 07:03:30.080325120", + # "1904-06-21 20:55:36.493869056", Review comment: > Calcutta time was one of the two time zones established in British India in 1884. It was established during the International Meridian Conference held at Washington, D.C. in the United States. It was decided that India had two time zones: Calcutta (now Kolkata) would use the 90th meridian east and Bombay (now Mumbai) the 75th meridian east. It was determined as 5 hours, 53 minutes and 20 seconds ahead of Greenwich Mean Time(UTC+5:53:20). https://en.wikipedia.org/wiki/Calcutta_Time -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org