def semicovariance(prices, benchmark=<NUM_LIT:0>, frequency=<NUM_LIT>):
if not isinstance(prices, pd.DataFrame):<EOL><INDENT>warnings.warn("<STR_LIT>", RuntimeWarning)<EOL>prices = pd.DataFrame(prices)<EOL><DEDENT>daily_returns = daily_price_returns(prices)<EOL>drops = np.fmin(daily_returns - benchmark, <NUM_LIT:0>)<EOL>return drops.cov() * frequency<EOL>
Estimate the semicovariance matrix, i.e the covariance given that
the returns are less than the benchmark.

.. semicov = E([min(r_i - B, 0)] . [min(r_j - B, 0)])

:param prices: adjusted closing prices of the asset, each row is a date
               and each column is a ticker/id.
:type prices: pd.DataFrame
:param benchmark: the benchmark return, defaults to 0.
:type benchmark: float
:param frequency: number of time periods in a year, defaults to 252 (the number
                  of trading days in a year)
:type frequency: int, optional
:return: semicovariance matrix
:rtype: pd.DataFrame