This page describes how to build and configure a pivoted shape data cube. For more information about the data shapes supported by csvcubed, see Shaping your data. The instructions below assume a basic understanding of writing a qube-config.json file.
See Converting to pivoted shape for instructions on how to convert the shape of your data in Python and R.
The standard shape is flexible but has a lot of redundancy which can often be removed by using the more concise pivoted form. Our data set on the distribution of the number of Arthur's Bakes stores can be expressed in the pivoted shape as follows:
|Year||Location||Number of Arthur's Bakes||Status|
Note that this shape doesn't require that you add any additional columns to the underlying common structure; however it does require a different (and explicit) qube-config.json configuration, to ensure that the corresponding measure and unit are attached to the observations column:
Incorporating multiple measures into the pivoted shape can be achieved by defining unit and measure information for each
observation column. Measures in the pivoted shape are always configured against the observed values column in the associated qube-config.json file. Units can be configured in two ways:
- By specifying a
unitproperty within the
observationcolumn definition (as with the "Number of Arthur's Bakes" observation column).
- By associating a separate
unitcolumn with the relevant
observationcolumn using the
describes_observationsproperty (as with the "Revenue Units" unit column). See the Measure and Unit Columns Configuration section for more information on the
describes_observation property can be used to associate attributes with the relevant observation values, as with the "Number of Stores Status" and "Revenue Status" attribute columns below. See the Attributes configuration section for more information on the
|Year||Location||Number of Arthur's Bakes||Number of Stores Status||Revenue||Revenue Units||Revenue Status|