CSVFile.del_rows

CSVFile.del_rows(col=None, val=None, invert=False)

Search in the numerica data for the lines that match and deletes the corresponding rows.

Parameters
  • col (list,slice,int,string, re, callable or None) – Column containg values to search for.

  • val (float or callable) –

    Specifies rows to delete. Maybe:
    • None - in which case the col argument is used to identify rows to be deleted,

    • a float in which case rows whose columncol = val are deleted

    • or a function - in which case rows where the function evaluates to be true are deleted.

    • a tuple, in which case rows where column col takes value between the minium and maximum of the tuple are deleted.

Keyword Arguments

invert (bool) – Specifies whether to invert the logic of the test to delete a row. If True, keep the rows that would have been deleted otherwise.

Returns

self – The current DataFile object

Note

If col is None, then all rows with masked data are deleted

if col is callable then it is passed each row as a DataArray and if it returns True, then the row will be deleted or kept depending on the value of invert.

If val is a callable it should take two arguments - a float and a list. The float is the value of the current row that corresponds to column col abd the second argument is the current row.

Todo

Implement val is a tuple for deletinging in a range of values.