qri-io / starlib

qri's standard library for starlark
MIT License
113 stars 29 forks source link

feat(dataframe): Method shift for DataFrame and Series, using adaptor #160

Closed dustmop closed 2 years ago

dustmop commented 2 years ago

This PR adds a new pattern that I hope to leverage more in the future. The method shift is added to DataFrame. Series is able to also use this functionality simply by using an adaptor, rather than needing its own implementation. The adaptor converts the Series to a single column DataFrame, runs the desired method, and then retrieves the resulting DataFrame and converts it back to a Series.