serial_dashboard.parsers.fill_nans

serial_dashboard.parsers.fill_nans(x, ncols)

Right-fill NaNs into an array so that each row has the same number of entries.

Parameters
  • x (list of lists) – Array with potentially unequal row lengths to be filled.

  • ncols (int) – Number of columns we wish to achieve after filling NaNs. We fill to the larger of the maximum row length of x and ncols.

Returns

output – Return a 2D Numpy array with all rows having the same number of columns, padded with NaNs. The exception is if the input is an empty list and ncols is zero, in which case np.array([]) is returned.

Return type

Numpy array

Notes

  • x is modified in place. Do not use this function if you want x back.

  • There is no type-checking on x. It must be a list of lists.