qis.df_last_row

qis.df_last_row(df, axis=0, is_nonan=True)[source]

last row (axis=0) or last column (axis=1); is_nonan takes the last finite value per key.

On a ragged panel the last row is not the last observation of every column: a series that stopped reporting earlier carries a NaN there. is_nonan=True takes each column’s own last finite value instead, which is what a current-holdings or latest-level read wants.

Parameters:
  • df (DataFrame) – values to read from

  • axis (Literal[0, 1]) – 0 takes the last row, giving one value per column; 1 takes the last column

  • is_nonan (bool) – with axis=0, take each column’s last finite value rather than the value at the final index entry. Ignored when axis=1

Returns:

the values as an array, in column order for axis=0 and row order for axis=1

Raises:

ValueError – if axis is not 0 or 1

Return type:

ndarray