In Python (especially with pandas), R (melt or reshape), and Excel (with VBA or by hand), you can transform data prior to import. If you have long or narrow format, you can use nest to group by some object identified. In D3's csv read, each row becomes an object with those attributes, hence often wide format is used for the data. long format for data - how do I transform it?