MokeFile.swap_column

MokeFile.swap_column(*swp, **kargs)

Swap pairs of columns in the data.

Useful for reordering data for idiot programs that expect columns in a fixed order.

Parameters
  • swp (tuple of list of tuples of two elements) – Each element will be iused as a column index (using the normal rules for matching columns). The two elements represent the two columns that are to be swapped.

  • headers_too (bool) – Indicates the column headers are swapped as well

Returns

self – A copy of the modified DataFile objects

Note

If swp is a list, then the function is called recursively on each element of the list. Thus in principle the @swp could contain lists of lists of tuples