Skip to content

Commit e41068a

Browse files
committed
comments, typo
1 parent df39bd7 commit e41068a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

pandas/core/arrays/timedeltas.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,9 @@ def astype(self, dtype, copy=True):
240240
dtype = pandas_dtype(dtype)
241241

242242
if is_timedelta64_dtype(dtype) and not is_timedelta64_ns_dtype(dtype):
243-
# essentially this is division
243+
# by pandas convention, converting to non-nano timedelta64
244+
# returns an int64-dtyped array with ints representing multiples
245+
# of the desired timedelta unit. This is essentially division
244246
result = self._data.astype(dtype, copy=copy)
245247
if self._hasnans:
246248
values = self._maybe_mask_results(result,

pandas/core/indexes/datetimelike.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,9 @@ def astype(self, dtype, copy=True):
542542
if is_integer_dtype(dtype):
543543
dtype = np.dtype("int64")
544544

545-
return Index(new_values, dtype=dtype, name=self.name)
545+
# pass copy=False because any copying will be done in the
546+
# _eadata.astype call above
547+
return Index(new_values, dtype=dtype, name=self.name, copy=False)
546548

547549
@Appender(DatetimeLikeArrayMixin._time_shift.__doc__)
548550
def _time_shift(self, periods, freq=None):

pandas/core/indexes/period.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ def astype(self, dtype, copy=True, how='start'):
544544
dtype = pandas_dtype(dtype)
545545

546546
if is_datetime64_any_dtype(dtype):
547-
# 'how' is index-speicifc, isn't part of the EA interface.
547+
# 'how' is index-specific, isn't part of the EA interface.
548548
tz = getattr(dtype, 'tz', None)
549549
return self.to_timestamp(how=how).tz_localize(tz)
550550

0 commit comments

Comments
 (0)