How do I unpivot data?

If you have a number of columns with values in them, and you want to create separate observations, each with a name and a value, you can do this with flatten_single(). This is especially helpful when shaping a metrics dataset. Collect all the values into an object, and then flatten that object. Then rename the output columns the way you want them.

// assume I have obj:{monday:5, tuesday:8, wednesday:12, ...}
flatten_single obj
pick_col
  timestamp,
  name:_c_obj_path,
  value:float64(_c_obj_value)

You can also look at the unpivot_array() function which takes an object into an array of key/value pairs.