Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Working at Twitter can involve working with large volumes of time series data, often in a variety of different formats. In order to gain valuable insights from the data, we must be able to efficiently record, parse, and categorize it, and display meaningful results to the viewer.
- For this exercise, you will work with input that represents engagement data at different times for an arbitrary time interval. The data is divided by categories including but not limited to impressions, clicks, favorites, and retweets. The purpose of the task is to aggregate the data by month and engagement category for the requested time interval.
- Input:
- 2015-08, 2016-04
- 2015-08-15, clicks, 635
- 2016-03-24, app_installs, 683
- 2015-04-05, favorites, 763
- 2016-01-22, favorites, 788
- 2015-12-26, clicks, 525
- 2016-06-03, retweets, 101
- 2015-12-02, app_installs, 982
- 2016-09-17, app_installs, 770
- 2015-11-07, impressions, 245
- 2016-10-16, impressions, 567
- Each line is terminated by a single newline character '\n'.
- The first line represents the start and end of the requested date interval. The start and end dates are separated by a single comma character ',' and zero or more space characters ' '.
- The second line is empty.
- The third line and onwards represent the time series data points. Each line represents a single data point, consisting of a date, engagement type, and number of engagements. The fields on each line are also separated by commas and optional spaces. Input dates are not expected to be in order.
- Output:
- 2016-03, app_installs, 683
- 2016-01, favorites, 788
- 2015-12, app_installs, 982, clicks, 525
- 2015-11, impressions, 245
- 2015-08, clicks, 635
- The output consists of a line for each month in the requested interval, separated by a single newline character '\n' in order of most recent date to latest date.
- Do not include months where there was no engagement data found.
- Each line consists of a month date (yyyy-mm), and the totals for each engagement type where the total is greater than 0. Each field on a given line must be separated by a single comma character ',' followed by a single space character ' '.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement