-
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
breaking changeBackwards incompatibleBackwards incompatiblecontribIntegration with 3rd party packagesIntegration with 3rd party packages
Milestone
Description
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 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. - It's impossible to statically type: Static type-checkers cannot "be told" that
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. - There are better alternatives:
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.
Metadata
Metadata
Assignees
Labels
breaking changeBackwards incompatibleBackwards incompatiblecontribIntegration with 3rd party packagesIntegration with 3rd party packages