qis.df_to_long_only_allocation_sum1

qis.df_to_long_only_allocation_sum1(df)[source]

normalise each row to sum to one after setting negative values to zero.

The long-only counterpart of df_to_weight_allocation_sum1(): negatives are dropped before normalising rather than after, so the surviving positives carry the full weight. A row with no positive value returns all zeros rather than dividing by zero.

Parameters:

df (Series | DataFrame) – scores, one column per asset. Non-positive entries and NaN become zero weight

Returns:

non-negative weights in the same shape, each row summing to one or to zero

Return type:

Series | DataFrame