Data.add_column

Data.add_column(column_data, header=None, index=None, **kargs)

Append a column of data or inserts a column to a datafile instance.

Parameters:

column_data (numpy.array or list or callable) – Data to append or insert or a callable function that will generate new data

Keyword Arguments:
  • column_header (string) – The text to set the column header to, if not supplied then defaults to ‘col#’

  • index (int or string) – The index (numeric or string) to insert (or replace) the data

  • func_args (dict) – If column_data is a callable object, then this argument can be used to supply a dictionary of function arguments to the callable object.

  • replace (bool) – Replace the data or insert the data (default)

  • setas (str) – Set the type of column (x,y,z data etc - see Stoner.Core.DataFile.setas)

Returns:

A DataFile instance with the additional column inserted.

Note

Like most DataFile methods, this method operates in-place in that it also modifies the original DataFile Instance as well as returning it.