You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

fntools

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fntools

Functional programming tools for data processing

1.1.2
pipPyPI
Maintainers
1

fntools

.. image:: https://readthedocs.org/projects/fntools/badge/?version=master

:target: https://readthedocs.org/projects/fntools/?badge=master :alt: Documentation Status

fntools provides functional programming tools for data processing. This module is a set of functions that I needed in my work and found useful.

Installation

::

pip install fntools

Examples

  • Split a list of elements with factors with split::

    songs = ('Black', 'Even Flow', 'Amongst the waves', 'Sirens') albums = ('Ten', 'Ten', 'Backspacer', 'Lightning Bolt') print split(songs, albums) {'Lightning Bolt': ['Sirens'], 'Ten': ['Black', 'Even Flow'], 'Backspacer': ['Amongst the waves']}

  • Determine whether any element of a list is included in another list with any_in::

    print any_in(['Oceans', 'Big Wave'], ['Once', 'Alive', 'Oceans', 'Release']) True

    print any_in(['Better Man'], ['Man of the Hour', 'Thumbing my way']) False

  • Apply many functions on the data with dispatch::

    Suppose we want to know the mean, the standard deviation and the median of

    a distribution (here we use the standard normal distribution)

    import numpy as np np.random.seed(10) x = np.random.randn(10000)

    print dispatch(x, (np.mean, np.std, np.median)) [0.0051020560019149385, 0.98966401277169491, 0.013111308495186252]

Many more useful functions are available. For more details, go to the documentation_.

Inspirations

  • The excellent toolz_ by Matthew Rocklin_
  • A pratical introduction to functional programming_ by Mary Rose Cook_
  • A bit of R_ (multimap, use, use_with)

.. _documentation: http://fntools.readthedocs.org/en/latest .. _toolz: https://github.com/mrocklin/toolz .. _A pratical introduction to functional programming: http://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming .. _Matthew Rocklin: https://github.com/mrocklin .. _Mary Rose Cook: https://github.com/maryrosecook .. _R: http://www.r-project.org

Keywords

functional programming tools data processing

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts