Can we filter performance based on the in-sample or out-of-sample period?

How can we filter performance based on the in-sample or out-of-sample period (without slicing the dataframe)? Any library suggestions?



Zipline Algorithm — pyfolio 0.9.3+28.g3dcf744 documentation



Link seen in this link.

Hello Emma,



Could you provide additional details regarding the performance metrics you intend to utilise?



To filter performance based on in-sample or out-of-sample periods without directly slicing the dataframe, Python libraries such as pandas, scikit-learn, and numpy can be employed. Here's a general approach:



1. Creation of a Boolean mask: Develop a boolean mask to signify whether each observation falls within the desired period (in-sample or out-of-sample).



2. Application of the mask: Utilise the boolean mask to filter the performance metrics.



Please give me an example of an use case for specific guidelines on how to approach the problem.