Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.DatetimeIndex.mean#

DatetimeIndex.mean(*,skipna=True,axis=0)[source]#

Return the mean value of the Array.

Parameters:
skipnabool, default True

Whether to ignore any NaT elements.

axisint, optional, default 0
Returns:
scalar

Timestamp or Timedelta.

See also

numpy.ndarray.mean

Returns the average of array elements along a given axis.

Series.mean

Return the mean value in a Series.

Notes

mean is only defined for Datetime and Timedelta dtypes, not for Period.

Examples

Forpandas.DatetimeIndex:

>>>idx=pd.date_range('2001-01-01 00:00',periods=3)>>>idxDatetimeIndex(['2001-01-01', '2001-01-02', '2001-01-03'],              dtype='datetime64[ns]', freq='D')>>>idx.mean()Timestamp('2001-01-02 00:00:00')

Forpandas.TimedeltaIndex:

>>>tdelta_idx=pd.to_timedelta([1,2,3],unit='D')>>>tdelta_idxTimedeltaIndex(['1 days', '2 days', '3 days'],                dtype='timedelta64[ns]', freq=None)>>>tdelta_idx.mean()Timedelta('2 days 00:00:00')

[8]ページ先頭

©2009-2025 Movatter.jp