Skip to content

Commit 3abdc28

Browse files
gfyoungPingviinituutti
authored andcommitted
CLN: Follow-up comments to pandas-devgh-23392 (pandas-dev#23401)
* Use 'unit' instead of 'frequency' * Minor spacing issues in docs Follow-up to pandas-devgh-23392
1 parent c5c18b3 commit 3abdc28

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

doc/source/whatsnew/v0.24.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ Removal of prior version deprecations/changes
942942
- Removal of the previously deprecated module ``pandas.core.datetools`` (:issue:`14105`, :issue:`14094`)
943943
- Strings passed into :meth:`DataFrame.groupby` that refer to both column and index levels will raise a ``ValueError`` (:issue:`14432`)
944944
- :meth:`Index.repeat` and :meth:`MultiIndex.repeat` have renamed the ``n`` argument to ``repeats`` (:issue:`14645`)
945-
- The ``Series`` constructor and ``.astype`` method will now raise a ``ValueError`` if timestamp dtypes are passed in without a frequency (e.g. ``np.datetime64``) for the ``dtype`` parameter (:issue:`15987`)
945+
- The ``Series`` constructor and ``.astype`` method will now raise a ``ValueError`` if timestamp dtypes are passed in without a unit (e.g. ``np.datetime64``) for the ``dtype`` parameter (:issue:`15987`)
946946
- Removal of the previously deprecated ``as_indexer`` keyword completely from ``str.match()`` (:issue:`22356`, :issue:`6581`)
947947
- The modules ``pandas.types``, ``pandas.computation``, and ``pandas.util.decorators`` have been removed (:issue:`16157`, :issue:`16250`)
948948
- Removed the ``pandas.formats.style`` shim for :class:`pandas.io.formats.style.Styler` (:issue:`16059`)

doc/test.parquet

889 Bytes
Binary file not shown.

pandas/core/dtypes/cast.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ def astype_nansafe(arr, dtype, copy=True, skipna=False):
667667
Raises
668668
------
669669
ValueError
670-
The dtype was a datetime /timedelta dtype, but it had no frequency.
670+
The dtype was a datetime64/timedelta64 dtype, but it had no unit.
671671
"""
672672

673673
# dispatch on extension dtype if needed
@@ -749,7 +749,7 @@ def astype_nansafe(arr, dtype, copy=True, skipna=False):
749749
return astype_nansafe(to_timedelta(arr).values, dtype, copy=copy)
750750

751751
if dtype.name in ("datetime64", "timedelta64"):
752-
msg = ("The '{dtype}' dtype has no frequency. "
752+
msg = ("The '{dtype}' dtype has no unit. "
753753
"Please pass in '{dtype}[ns]' instead.")
754754
raise ValueError(msg.format(dtype=dtype.name))
755755

@@ -1021,7 +1021,7 @@ def maybe_cast_to_datetime(value, dtype, errors='raise'):
10211021
if is_datetime64 or is_datetime64tz or is_timedelta64:
10221022

10231023
# Force the dtype if needed.
1024-
msg = ("The '{dtype}' dtype has no frequency. "
1024+
msg = ("The '{dtype}' dtype has no unit. "
10251025
"Please pass in '{dtype}[ns]' instead.")
10261026

10271027
if is_datetime64 and not is_dtype_equal(dtype, _NS_DTYPE):

pandas/tests/series/test_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ def test_constructor_cast_object(self, index):
11981198
])
11991199
def test_constructor_generic_timestamp_no_frequency(self, dtype):
12001200
# see gh-15524, gh-15987
1201-
msg = "dtype has no frequency. Please pass in"
1201+
msg = "dtype has no unit. Please pass in"
12021202

12031203
with tm.assert_raises_regex(ValueError, msg):
12041204
Series([], dtype=dtype)

pandas/tests/series/test_dtypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def test_astype_generic_timestamp_no_frequency(self, dtype):
404404
data = [1]
405405
s = Series(data)
406406

407-
msg = "dtype has no frequency. Please pass in"
407+
msg = "dtype has no unit. Please pass in"
408408
with tm.assert_raises_regex(ValueError, msg):
409409
s.astype(dtype)
410410

0 commit comments

Comments
 (0)