def top(self, N, mask=NotSpecified, groupby=NotSpecified):
"""
Construct a Filter matching the top N asset values of self each day.
If ``groupby`` is supplied, returns a Filter matching the top N asset
values for each group.
Parameters
----------
N : int
Number of assets passing the returned filter each day.
mask : catalyst.pipeline.Filter, optional
A Filter representing assets to consider when computing ranks.
If mask is supplied, top values are computed ignoring any
asset/date pairs for which `mask` produces a value of False.
groupby : catalyst.pipeline.Classifier, optional
A classifier defining partitions over which to perform ranking.
Returns
-------
filter : catalyst.pipeline.filters.Filter
"""
return self.rank(ascending=False, mask=mask, groupby=groupby) <= N
评论列表
文章目录