Skip to content

Instantly share code, notes, and snippets.

@besquared
Created July 15, 2009 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save besquared/147499 to your computer and use it in GitHub Desktop.
Save besquared/147499 to your computer and use it in GitHub Desktop.
#
# This is probably a decent interview assignment
#
# Pivot Function
#
# The pivot function takes the unique values of a table column and turns them into
# columns of a new table, with the values of the new cells being chosen from a column
# in the original table
#
# Example:
#
# hour | source | revenue
# 1 | A | 100
# 1 | B | 200
# 2 | A | 200
#
# Becomes
#
# hour | A | B
# 1 | 100 | 200
# 2 | 200 | nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment