Data.swap_column

Data.swap_column(*swp, headers_too=True, **kwargs)

Swap pairs of columns in the data.

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

Parameters:
  • datafile (Data) – Data object to work with if not being used as a bound method.

  • 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.

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

  • **kwargs – Other keyword arguments passed to Stoner.DataArray.swap_cokumns().

Returns:

datafile – 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