Skip to content

Commit a26506c

Browse files
rokpitrou
authored andcommitted
ARROW-15748: [Python] Round temporal options default unit is day but documented as second
This is to resolve [ARROW-15748](https://issues.apache.org/jira/browse/ARROW-15748). Closes #12507 from rok/ARROW-15748 Authored-by: Rok <rok@mihevc.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
1 parent 9df9bad commit a26506c

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

python/pyarrow/_compute.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,14 +882,14 @@ class RoundTemporalOptions(_RoundTemporalOptions):
882882
----------
883883
multiple : int, default 1
884884
Number of units to round to.
885-
unit : str, default "second"
885+
unit : str, default "day"
886886
The unit in which `multiple` is expressed.
887887
Accepted values are "year", "quarter", "month", "week", "day",
888888
"hour", "minute", "second", "millisecond", "microsecond",
889889
"nanosecond".
890890
"""
891891

892-
def __init__(self, multiple=1, unit="second"):
892+
def __init__(self, multiple=1, unit="day"):
893893
self._set_options(multiple, unit)
894894

895895

python/pyarrow/tests/test_compute.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2032,6 +2032,11 @@ def _check_temporal_rounding(ts, values, unit):
20322032
expected = ts.dt.round(frequency)
20332033
np.testing.assert_array_equal(result, expected)
20342034

2035+
# Check RoundTemporalOptions defaults
2036+
result = pc.round_temporal(ta).to_pandas()
2037+
expected = ts.dt.round("1D")
2038+
np.testing.assert_array_equal(result, expected)
2039+
20352040

20362041
# TODO: We should test on windows once ARROW-13168 is resolved.
20372042
@pytest.mark.skipif(sys.platform == 'win32',

0 commit comments

Comments
 (0)