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

Added Keyed Return for SeriesStats #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/main/scala/com/cloudera/sparkts/TimeSeriesRDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,15 @@ class TimeSeriesRDD[K](val index: DateTimeIndex, parent: RDD[(K, Vector)])
* Gets stats like min, max, mean, and standard deviation for each time series.
*/
def seriesStats(): RDD[StatCounter] = {
map(kt => new StatCounter(kt._2.valuesIterator))
map(kt => new StatCounter(kt._2.valuesIterator))
Copy link
Owner

Choose a reason for hiding this comment

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

Thinking about it now, I think it actually makes sense to include the keys with the stats in all cases, i.e. to just change the return type of seriesStats.

}

/**
* Gets stats like min, max, mean, and standard deviation for each time series and includes the key for the
* time-series
*/
def seriesStatsWithkey(): RDD[(K, StatCounter)] = {
map(kt => (kt._1, new StatCounter(kt._2.valuesIterator)))
}

/**
Expand Down