View Source Coda.Analytics (coda v0.1.0)

Common data frame analytics functions.

Summary

Functions

Calculate stats for a single group such as "artist", "album".

Compute frequency for a columns subset, filter untitled albums.

Rank data frame by total plays count and return top n rows.

Types

Functions

Link to this function

create_facet_stats(df, df_source)

View Source
Link to this function

create_facet_stats(df, facet, index)

View Source
Link to this function

create_group_stats(df, group)

View Source
@spec create_group_stats(data_frame(), String.t()) :: data_frame()

Calculate stats for a single group such as "artist", "album".

Stats include:

  • years_freq: frequency of yearly occurrance per group
  • total_plays: total number of plays per group

The function also pivots and creates additional year columns with annual play counts per group.

Link to this function

frequencies(df, group, opts \\ [])

View Source
@spec frequencies(data_frame(), group(), keyword()) :: data_frame()

Compute frequency for a columns subset, filter untitled albums.

Options:

  • filter - an Explorer.DataFrame filter function that excludes data in analytics
  • counts - includes only facets with this counts (integer)
Link to this function

most_played(df, opts \\ [])

View Source
@spec most_played(data_frame(), list()) :: data_frame()

Rank data frame by total plays count and return top n rows.