Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-vbudati committed Sep 12, 2024
1 parent d1c2cdf commit 82eec96
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/snowflake/snowpark/modin/plugin/extensions/datetime_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from __future__ import annotations

from datetime import tzinfo
from datetime import timedelta, tzinfo

import modin
import numpy as np
Expand Down Expand Up @@ -1489,7 +1489,6 @@ def to_pydatetime(self) -> np.ndarray:
datetime.datetime(2018, 3, 1, 0, 0)], dtype=object)
"""

@datetime_index_not_implemented()
def mean(
self, *, skipna: bool = True, axis: AxisInt | None = 0
) -> native_pd.Timestamp:
Expand Down Expand Up @@ -1520,11 +1519,16 @@ def mean(
>>> idx = pd.date_range('2001-01-01 00:00', periods=3)
>>> idx
DatetimeIndex(['2001-01-01', '2001-01-02', '2001-01-03'], dtype='datetime64[ns]', freq=None)
>>> idx.mean() # doctest: +SKIP
>>> idx.mean()
Timestamp('2001-01-02 00:00:00')
"""
return (
self.to_series()
.agg("mean", axis=axis, skipna=skipna)
.to_pandas()
.squeeze(axis=1)
)

@datetime_index_not_implemented()
def std(
self,
axis=None,
Expand All @@ -1533,7 +1537,7 @@ def std(
ddof: int = 1,
keepdims: bool = False,
skipna: bool = True,
):
) -> timedelta:
"""
Return sample standard deviation over requested axis.
Expand Down Expand Up @@ -1568,6 +1572,16 @@ def std(
>>> idx = pd.date_range('2001-01-01 00:00', periods=3)
>>> idx
DatetimeIndex(['2001-01-01', '2001-01-02', '2001-01-03'], dtype='datetime64[ns]', freq=None)
>>> idx.std() # doctest: +SKIP
>>> idx.std()
Timedelta('1 days 00:00:00')
"""
kwargs = {
"dtype": dtype,
"out": out,
"ddof": ddof,
"keepdims": keepdims,
"skipna": skipna,
}
return (
self.to_series().agg("std", axis=axis, **kwargs).to_pandas().squeeze(axis=1)
)

0 comments on commit 82eec96

Please sign in to comment.