Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1559025 Implement DatetimeIndex.mean and DatetimeIndex.std #2292

Merged
merged 13 commits into from
Sep 18, 2024

Conversation

sfc-gh-vbudati
Copy link
Contributor

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-1559025

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
  3. Please describe how your code solves the related issue.

Implemented DatetimeIndex.mean and DatetimeIndex.std.

Copy link
Contributor

@sfc-gh-rdurrani sfc-gh-rdurrani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

# Need to convert timestamp to seconds to prevent overflow when aggregating.
# Cannot directly convert a timestamp to a float; therefore, first convert it to an int then a float.
return to_timedelta(
(self.to_series().astype(int) / 1e9).agg(
Copy link
Collaborator

@sfc-gh-azhan sfc-gh-azhan Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(self.to_series().astype(int) / 1e9).agg(
(self.to_series().astype(int) // 1_000_000_000).agg(

1e9 is a float not a int.
Please also describe why we did this.

@sfc-gh-vbudati sfc-gh-vbudati merged commit a07902c into main Sep 18, 2024
35 checks passed
@sfc-gh-vbudati sfc-gh-vbudati deleted the vbudati/SNOW-1559025-datetimeindex-mean-std branch September 18, 2024 20:14
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants