You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, if pandas is installed, import lmo automatically registers the dataframe- and series accessors (pandas docs). There are several major issues with this approach:
It significantly slows down import lmo if pandas is installed, even if the user doesn't import pandas. If I remember correctly from a benchmark I did a while back, this is responsible for the majority of the runtime of an (initial) import lmo call.
It's impossible to statically type: Static type-checkers cannot "be told" that pd.DataFrame and pd.Series actually have the l_* methods, let alone their exact signatures. The only workaround is to manually cast the dataframe or series instances to lmo.contrib.pandas.{DataFrame,Pandas}, which is very annoying.
There are better alternatives:
Series.l_{}(...) just calls lmo.l_{}(_, ...) on the instance, and in the "plural" cases, rewraps it as a Series with a new "r" index. Once Support __array_ufunc__ in lmo.l_(loc|scale|variation|skew|kurtosis) #184 is implemented, this could (for the most part) also be done with a simple lmo.l_{}, which is a better alternative.
DataFrame.l_{}(...) is basically an alias for DataFrame.apply(lmo.l_{}, ...), so almost as easy to do it manually.
Currently, if pandas is installed,
import lmoautomatically registers the dataframe- and series accessors (pandas docs). There are several major issues with this approach:import lmoifpandasis installed, even if the user doesn't importpandas. If I remember correctly from a benchmark I did a while back, this is responsible for the majority of the runtime of an (initial)import lmocall.pd.DataFrameandpd.Seriesactually have thel_*methods, let alone their exact signatures. The only workaround is to manuallycastthe dataframe or series instances tolmo.contrib.pandas.{DataFrame,Pandas}, which is very annoying.Series.l_{}(...)just callslmo.l_{}(_, ...)on the instance, and in the "plural" cases, rewraps it as aSerieswith a new"r"index. Once Support__array_ufunc__inlmo.l_(loc|scale|variation|skew|kurtosis)#184 is implemented, this could (for the most part) also be done with a simplelmo.l_{}, which is a better alternative.DataFrame.l_{}(...)is basically an alias forDataFrame.apply(lmo.l_{}, ...), so almost as easy to do it manually.