passing cleaningFun to data features (Python)

According to the docs, a cleaningFun is a function that takes a DataFrame of prices as first input and then applies some cleaning function to return the cleaned DataFrame. However, the source code shows that the cleaning function is implemented as a method belonging to the DataFrame class (see screenshot). As a result, passing a cleaning function to data features where the function is defined as:


</p><p>def cleanFunc(pxs):</p><p> return pxs.dropna(how='all')</p><p>


… throws an error. Has anyone encountered this and if so, are there any solutions to this that don’t require using PandasObject?


DataFeatures(tickers=tkr, cleaningFun = lambda x: x.dropna()) should do it.

To add on top of this, you can check the cleaningMethod argument. Doc accessible directly from lab.

?alphien.data.DataFeatures

You can see that dropping na is already a preset method so you don’t need to write a function (or a lambda) to do something standard.


Thank you!