GithubHelp home page GithubHelp logo

ab-be / swifter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jmcarpenter2/swifter

0.0 1.0 0.0 295 KB

A package which efficiently applies any function to a pandas dataframe or series in the fastest available manner

License: MIT License

Python 100.00%

swifter's Introduction

swifter

A package which efficiently applies any function to a pandas dataframe or series in the fastest available manner

Installation:

$pip install swifter # first time installation
$pip install -U swifter # upgrade to latest version

and then import into your code using:

from swifter import swiftapply

Easy to use

myDF['outCol'] = swiftapply(myDF['inCol'], my_func)
myDF['outCol'] = swiftapply(myDF['inCol'], my_func, positional_arg, keyword_arg=keyword_argval)

Check out the examples notebook, along with the speed benchmark notebook

Vectorizes your function, when possible

Alt text Alt text

When vectorization is not possible, automatically decides which is faster: to use dask parallel processing or a simple pandas apply

Alt text Alt text

Notes

  1. The function is documented in the .py file. In Jupyter Notebooks, you can see the docs by pressing Shift+Tab(x3). Also, check out the complete documentation here along with the changelog.

  2. When using swiftapply on a dataframe with a non-vectorized function call, swiftapply will resort to concatenating swiftapplies on each column because dask applymap does not work properly as of now. Submitting a bug fix shortly.

swifter's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.