|
|
|
|
|
by dragonwriter
2083 days ago
|
|
> From my intuition, I don't see anything stopping the function from existing A datatable is (or is isomorphic to and can be analyzed as) a mapping from row numbers to tuples of a given shape[0]. The transpose of table will only be table (a mapping from rows numbers to tuples of a common shape) if the tuples of the starting table were homogenous (every field of the same type.) This works with, say, matrices where all the elements are numbers; but it fails in the general case. [0] Yes, I know, Julia defines them as columns of arrays, and columnar organization is ideal for all kinds of processing tasks. For me, thinking about and explaining the the problem with transpose works easier thinking about it in row-oriented form (which is logically equivalent). In column-oriented description, a datatable is an ordered set of columns, each of which is a homogenous array, but if you try to transpose it, each of the columns of the result would be a heterogenous array unless the columns were all of the same type to start with. So, again, it fails to be a table->table function except in the case where the starting table consists of columns of identical type. |
|
Scenario #1: If the tuples are the same shape (type, size), it's fine
transposed: Both input and output have tables with consistent shapes (type, size)Scenario #2: Assuming its legal, if the tuples are differently shaped (by datatype), its weird (but that was true of your original table anyways), but you can still do a valid transposition to produce a valid table
transposed: It was weird to begin with, and it's similarly weird to end with. I can't imagine the output not being a legal table by any rule that does not also disallow the input.Scenario #3: Similarly to scenario 2, If your tuples are differently shaped (by size), you can still do a transposition
transposed: and like Scenario #2, the output is as illegal as the inputIn the latter two cases, I don't know what you'd want to do with the transposition (or even its input), but I don't see anything stopping the operation itself from being reasonable/consistent/valid.
Is there another scenario I'm failing to imagine?