{ "info": { "author": "Koos Zevenhoven", "author_email": "koos.zevenhoven@aalto.fi", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3" ], "description": "np -- create numpy arrays as ``np[1,3,5]``, and more\n====================================================\n\n``np`` = ``numpy`` + handy tools\n\nIt's easy: start by importing ``np`` (the alias for numpy):\n\n.. code-block:: python\n\n import np\n\n\nCreate a 1-D array: \n \n.. code-block:: python\n\n np[1, 3, 5]\n\n\nCreate a 2-D matrix:\n\n.. code-block:: python\n\n np.m[1, 2, 3: \n :4, 5, 6:\n :7, 8, 9]\n\n\nFor the numerical Python package ``numpy`` itself, see http://www.numpy.org/.\n\nThe idea of ``np`` is to provide a way of creating numpy arrays with a compact syntax and without an explicit function call. Making the module name ``np`` subscriptable, while still keeping it essentially an alias for numpy, does this in a clean way.\n\nAny feedback is very welcome: ``koos.zevenhoven@aalto.fi``.\n\nGetting Started\n===============\n\nRequirements\n------------\n\n* Works best with Python 3.5+ (Tested also with 3.4 and 2.7)\n* numpy (you should install this using your python package manager like ``conda`` or ``pip``)\n\nInstallation\n------------\n\n``np`` can be installed with ``pip`` or ``pip3``:\n\n.. code-block:: bash\n\n $ pip install np\n\n\nor directly from the source code:\n\n.. code-block:: bash\n\n $ git clone https://github.com/k7hoven/np.git\n $ cd np\n $ python setup.py install \n\nBasic Usage\n===========\n\nEven before the ``np`` tool, a popular style of using ``numpy`` has been to import it as ``np``:\n\n.. code-block:: python\n\n >>> import numpy as np\n >>> my_array = np.array([3, 4, 5])\n >>> my_2d_array = np.array([[1, 2], [3, 4]])\n\nThe most important feature of ``np`` is to make the creation of arrays less verbose, while everything else works as before. The above code becomes:\n\n.. code-block:: python\n\n >>> import np\n >>> my_array = np[3, 4, 5]\n >>> my_2d_array = np[[1, 2], [3, 4]]\n >>> my_matrix = np.m[1, 2: 3, 4]\n >>> my_matrix2 = np.m[1, 2, 3:\n ... :4, 5, 6:\n ... :7, 8, 9]\n >>> my_row_vector = np.m[1, 2, 3]\n\n\nAs you can see from the above example, you can create numpy arrays by subscripting the ``np`` module. Since most people would have numpy imported as ``np`` anyway, this requires no additional names to clutter the namespace. Also, the syntax ``np[1,2,3]`` resembles the syntax for ``bytes`` literals, ``b\"asd\"``.\n\nThe above also shows how you can use ``np.m`` and colons to easily create matrices (NxM) or row vectors (1xM).\n\nThe `np` package also provides a convenient way of ensuring something is a numpy array, that is, a shortcut to ``numpy.asarray()``:\n\n.. code-block:: python\n\n >>> import np\n >>> mylist = [1, 3, 5]\n >>> mylist + [7, 9, 11]\n [1, 3, 5, 7, 9, 11]\n >>> np(mylist) + [7, 9, 11]\n array([8, 12, 16])\n\n\nAs an experimental feature, there are also shortcuts for giving the arrays a specific data type (numpy dtype):\n\n.. code-block:: python\n\n >>> np[1, 2, 3]\n array([1, 2, 3])\n >>> np.f[1, 2, 3]\n array([ 1., 2., 3.])\n >>> np.f2[1, 2, 3]\n array([ 1., 2., 3.], dtype=float16)\n >>> np.u4[1, 2, 3]\n array([1, 2, 3], dtype=uint32)\n >>> np.c[1, 2, 3]\n array([ 1.+0.j, 2.+0.j, 3.+0.j])\n\n\nChangelog\n=========\n\n1.0.0 (2017-09-20)\n------------------\n\n- Creating matrices is now even simpler::\n \n np.m[1, 2: 3, 4] == np.array([[1, 2], [3, 4]])\n\n np.m[1, 2:\n :3, 4] == np.array([[1, 2], [3, 4]])\n\n np.m[1, 2] == np.array([[1, 2]])\n\n np.m[1, 2].T == np.array([[1],\n [2]])\n\n\n- ``np(...)`` corresponds to ``np.asarray(...)``\n- Many improvements to error handling\n- Some more cleanups to type shortcuts\n\n0.2.0 (2016-03-29)\n------------------\n\n- Quick types are now ``np.i``, ``np.f``, ``np.u``, ``np.c``, or with the \n number of *bytes* per value appended: \n ``np.i4`` -> int32, ``np.u2`` -> uint16, ``np.c16`` -> complex128, ...\n (still somewhat experimental)\n- Removed the old np.i8 and np.ui8 which represented 8-bit types, which\n was inconsistent with short numpy dtype names which correspond to numbers of\n bytes. The rest of the bit-based shortcuts are deprecated and will be removed\n later.\n- Handle Python versions >=3.5 better; now even previously imported plain numpy\n module objects become the exact same object as np. \n- Tests for all np functionality\n- Ridiculously slow tests that runs the numpy test suite several times to\n make sure that np does not affect numpy functionality.\n- Remove numpy from requirements and give a meaningful error instead if numpy\n is missing (i.e. install it using your package manager like conda or pip)\n- Better reprs for subscriptable array creator objects and the np/numpy module.\n\n0.1.4 (2016-01-26)\n------------------\n\n- Bug fix\n\n0.1.2 (2015-06-17)\n------------------\n\n- Improved experimental dtype shortcuts: np.f[1,2], np.i32[1,2], etc.\n\n0.1.1 (2015-06-17)\n------------------\n\n- PyPI-friendly readme\n\n0.1.0 (2015-06-17)\n------------------\n\n- First distributable version\n- Easy arrays such as np[[1,2],[3,4]]\n- Shortcut for np.asanyarray(obj): np(obj)\n- Experimental dtype shortcuts: np.f64[[1,2],[3,4]]", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/k7hoven/np", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "np", "package_url": "https://pypi.org/project/np/", "platform": "", "project_url": "https://pypi.org/project/np/", "project_urls": { "Homepage": "https://github.com/k7hoven/np" }, "release_url": "https://pypi.org/project/np/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "np = numpy++: numpy with added convenience functionality", "version": "1.0.2" }, "last_serial": 3227708, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "63a32dbfc1e5f56686364afd07e0bbda", "sha256": "a5ad5f6f2343b29542e7052b02c2b1aa3779d1b5ead20b997e0c06ffd06257c1" }, "downloads": -1, "filename": "np-0.1.2.tar.gz", "has_sig": false, "md5_digest": "63a32dbfc1e5f56686364afd07e0bbda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3901, "upload_time": "2015-06-16T13:24:16", "url": "https://files.pythonhosted.org/packages/30/d9/0804f2adfd2f4c67553db35e62ad469c583ac2ebb92c538e84087e712f92/np-0.1.2.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "1655fb618af3e2a4d05588ebee85e8f0", "sha256": "6cf675153369a091de6859c9740cf2da51b065fef21f7995d7abd3ce3f39d107" }, "downloads": -1, "filename": "np-0.1.4.tar.gz", "has_sig": false, "md5_digest": "1655fb618af3e2a4d05588ebee85e8f0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4032, "upload_time": "2016-01-26T19:19:38", "url": "https://files.pythonhosted.org/packages/01/01/d6649fe4b05474a48b4df850fceeb596706dd8d7d531b448b33b89f9ec16/np-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "99b2957e45fa68909b88f3dc2e0cf684", "sha256": "cd655d688ebdaa4b00ef625e63e9b28d7f4fae6fb921ef9e65e5ca8da9dad9d7" }, "downloads": -1, "filename": "np-0.2.0.tar.gz", "has_sig": false, "md5_digest": "99b2957e45fa68909b88f3dc2e0cf684", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5244, "upload_time": "2016-03-28T21:52:22", "url": "https://files.pythonhosted.org/packages/7a/40/c11a7d07879d514de7f271182903647566afc13abf21e9ac48a0fcc251ad/np-0.2.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "3ae1bfd5447f8e762f98cf99a3c9737d", "sha256": "385bf93bce32ebc481fb8d89733bceb7afd1f3b1219c8905d7708f28083d85f9" }, "downloads": -1, "filename": "np-1.0.1.tar.gz", "has_sig": false, "md5_digest": "3ae1bfd5447f8e762f98cf99a3c9737d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7421, "upload_time": "2017-10-04T17:08:43", "url": "https://files.pythonhosted.org/packages/72/09/be7797c6b080bd62824cdc45f5de8065f97fac8f84fdc8b37b0a4837ca90/np-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "12cf904e710b5ab5e15db1f2595e49a8", "sha256": "781265283f3823663ad8fb48741aae62abcf4c78bc19f908f8aa7c1d3eb132f8" }, "downloads": -1, "filename": "np-1.0.2.tar.gz", "has_sig": false, "md5_digest": "12cf904e710b5ab5e15db1f2595e49a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7419, "upload_time": "2017-10-05T11:26:00", "url": "https://files.pythonhosted.org/packages/40/7d/749666e5a9976dcbc4d16d487bbe571efc6bbf4cdf3f4620c0ccc52b57ef/np-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "12cf904e710b5ab5e15db1f2595e49a8", "sha256": "781265283f3823663ad8fb48741aae62abcf4c78bc19f908f8aa7c1d3eb132f8" }, "downloads": -1, "filename": "np-1.0.2.tar.gz", "has_sig": false, "md5_digest": "12cf904e710b5ab5e15db1f2595e49a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7419, "upload_time": "2017-10-05T11:26:00", "url": "https://files.pythonhosted.org/packages/40/7d/749666e5a9976dcbc4d16d487bbe571efc6bbf4cdf3f4620c0ccc52b57ef/np-1.0.2.tar.gz" } ] }