Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orthoin3d/django-ndarrayfield
New Django field to store numpy ndarray.
https://github.com/orthoin3d/django-ndarrayfield
django django-fields numpy numpy-arrays
Last synced: 5 days ago
JSON representation
New Django field to store numpy ndarray.
- Host: GitHub
- URL: https://github.com/orthoin3d/django-ndarrayfield
- Owner: ORTHOIN3D
- License: apache-2.0
- Created: 2020-12-21T15:11:06.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-10T08:31:58.000Z (over 3 years ago)
- Last Synced: 2024-11-13T20:08:38.751Z (5 days ago)
- Topics: django, django-fields, numpy, numpy-arrays
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# django-ndarrayfield
New Django field to store numpy ndarray.## Description
Store a numpy n-dimensional array in database (compatible with all database backend).
Use numpy save/load, you can define a shape (not required), and a dtype (default float32).## Usage
```python
import numpy as np
from django.db import models
from ndarraydjango.fields import NDArrayFieldclass MyModel(models.Model):
vec1 = NDArrayField(shape=(32, 4), dtype=np.float64)
date = models.DateTimeField(auto_now_add=True)
```## Parameters
* **dtype**: the ndarray dtype (default np.float32)
* **shape**: the ndarray shape (default None)
* **binary_serialize**: when dump data, serialize to binary (base64) or json lists (default False)## Warning
This field type does not replace a static file storage.
The main goal is to store parameter data, results of algorithms and
small and medium machine learning models.
A good indication is the shape of the nd-array. It would be static,
and with a reasonable size. The overrall data size should not exceed 1mb.
For example a field of 300x400 of 2 float32 value ( (300, 400, 2) dtype=float32)
should be a maximum.