semvec/pypi-packages huggingface dataset:
cythoncartesian2 0.10
Cartesian Product for NumPy - 40x faster than NumPy + itertools.product
License: MIT
Keywords: cython,arrays,cartesian,numpy


# Cartesian Product for NumPy - 40x faster than NumPy + itertools.product 

## pip install cythoncartesian2

### Tested against Windows / Python 3.11 / Anaconda

## Cython (and a C/C++ compiler) must be installed




```python

cartesian_product(*args, outputdtype=np.uint32, dtype=np.uint32):
    Calculate the Cartesian product of input arrays.

    Parameters:
    - *args: Variable number of input arrays.
    - outputdtype (numpy.dtype): Data type of the output array.
    - dtype (numpy.dtype): Data type used for intermediate calculations. # be careful!

    Returns:
    - numpy.ndarray: Cartesian product of input arrays.

	
import random
from cythoncartesian2 import cartesian_product
import numpy as np

# Strings are NOT supported!

args=[[h*random.uniform(1,4) for h in (range(random.randint(2,9)))] for x in range(9)]
q=cartesian_product(*args,outputdtype=np.float32,dtype=np.uint32)

# array([[0.       , 0.       , 0.       , ..., 0.       , 0.       ,
#         0.       ],
#        [3.529998 , 0.       , 0.       , ..., 0.       , 0.       ,
#         0.       ],
#        [0.       , 3.715651 , 0.       , ..., 0.       , 0.       ,
#         0.       ],
#        ...,
#        [3.529998 , 7.956308 , 5.9014587, ..., 1.0379078, 7.9018135,
#         8.816498 ],
#        [0.       , 9.456019 , 5.9014587, ..., 1.0379078, 7.9018135,
#         8.816498 ],
#        [3.529998 , 9.456019 , 5.9014587, ..., 1.0379078, 7.9018135,
#         8.816498 ]], dtype=float32)

args=[[h for h in (range(8))] for x in range(9)]
q=cartesian_product(*args,outputdtype=np.uint8,dtype=np.uint32)

# %timeit q=cartesian_product(*args,outputdtype=np.uint8,dtype=np.uint32)
# 1.63 s ± 36.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

# %timeit (list(itertools.product(*args)))
# 11.3 s ± 180 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

# %timeit q=np.array(list(itertools.product(*args)),dtype=np.uint8)
# 1min 6s ± 282 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

# q
# Out[3]:
# array([[0, 0, 0, ..., 0, 0, 0],
#        [1, 0, 0, ..., 0, 0, 0],
#        [2, 0, 0, ..., 0, 0, 0],
#        ...,
#        [5, 7, 7, ..., 7, 7, 7],
#        [6, 7, 7, ..., 7, 7, 7],
#        [7, 7, 7, ..., 7, 7, 7]], dtype=uint8)
```
fdadb 0.2.0
FDA Drug Database
License: MIT

============
UNMAINTAINED
============

**PLEASE NOTE**: this library is not actively maintained and receives
only minimal updates necessary.  Most of it is no longer in active use
at Ro.


=====
fdadb
=====
|travis|_ |pypi|_ |codecov|_ |requiresio|_

A Django wrapper for `fda.gov <https://www.fda.gov>`_ National Drug Code (NDC) database.
**fdadb** stores each row under one name **MedicationName** object instead of having multiple drugs with the same name
next to each other, for example: In the NDC database there are around 21 Viagras (with different strengths)
so in such case we save the **MedicationName: Viagra** and under this name we store all the 21 instances.
This allows for better user experience when searching through the list of drugs.

Setting Up
==========
* ``pip install fdadb``
* Add ``fdadb`` to your ``INSTALLED_APPS``
* ``./manage.py migrate fdadb``
* ``./manage.py fetch_ndc_database`` - might take 15-30 minutes (the command will fetch all items from FDA database and save it in your project)

API:
====
**All APIs are searchable with ?q=term query param.**

medications/
------------
Returns list of **MedicationName** objects (pass ``?q=termtosearch`` to filter the results),
this API supports ElasticSearch for fast querying. Pagination does not work yet when ElasticSearch is enabled
(in most cases this does not cause any issues, as this API is generally used for drug autocomplete). You can change the
autocomplete limit by setting ``FDADB_AUTOCOMPLETE_LIMIT`` in your Django configuration (default: ``10``).

The ElasticSearch uses ngram for the query parameter.

medications/(?P<medication_name>[\w-]+)/strengths
-------------------------------------------------
Returns list of medication strengths

medications/(?P<medication_name>[\w-]+)/strengths/(?P<strength_id>[\d-]+)/ndcs
------------------------------------------------------------------------------
Returns list of Medication NDCs

ElasticSearch
=============
To enable support of ElasticSearch in autocomplete, set:

* ``ELASTICSEARCH_URL`` in project configuration
* Run ``./manage.py fdadb_es_index`` after fetching the NDC database (use ``--drop_indexes`` in case you want to cleanup the medications index)

Manage.py commands
==================
* ./manage.py fdadb_es_index - indexes the products into ElasticSearch
* ./manage.py fetch_ndc_database - fetches products data from NDS DB and saves in the database

Support
=======
* Django 1.11, 2.1, 2.2
* Python 3.4-3.6

.. |travis| image:: https://secure.travis-ci.org/HealthByRo/fdadb.svg?branch=master
.. _travis: http://travis-ci.org/HealthByRo/fdadb

.. |pypi| image:: https://img.shields.io/pypi/v/fdadb.svg
.. _pypi: https://pypi.python.org/pypi/fdadb

.. |codecov| image:: https://codecov.io/gh/HealthByRo/fdadb/branch/master/graph/badge.svg
.. _codecov: https://codecov.io/gh/HealthByRo/fdadb

.. |requiresio| image:: https://requires.io/github/HealthByRo/fdadb/requirements.svg?branch=master
.. _requiresio: https://requires.io/github/HealthByRo/fdadb/requirements/