1
나는 팬더가 같은 개체를 가지고 :팬더는 datetimeindex
hrIdx
(array([ 23, 47, 71, 95, 119, 143, 167, 191, 215, 239, 263,
287, 311, 335, 359, 383, 407, 431, 455, 479, 503, 527,
551, 575, 599, ...,1592], dtype=int64),)
나는 다음과 같은 노력하고 있어요 :
df_days[hrIdx] = df_days[hrIdx] + td(days=-1)
을
df_days
DatetimeIndex(['2015-05-24', '2015-05-24', '2015-05-24',..., '2016-03-19',
'2016-03-19', '2016-03-20'],
dtype='datetime64[ns]', length=7224, freq=None)
type(df_days)
<class 'pandas.tseries.index.DatetimeIndex'>
나뿐만 인덱스의 배열을 가지고
그러나 할당 작업이 실패합니다. 하루를 빼는 오른쪽 작업은 정상적으로 작동합니다.
오류는 다음과 같습니다
raise TypeError("Index does not support mutable operations")
TypeError: Index does not support mutable operations
내가 위 달성하기 위해 노력했다처럼 df_days
의 특정 요소를 변경하는 적절한 방법은 무엇입니까?
편집 :
from datetime import timedelta as td