Skip to main content

Yet another numpy ndarray fields for Django

Project description

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

import numpy as np
from django.db import models
from ndarraydjango.fields import NDArrayField


class 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-ndarrayfield-1.0.0rc4.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file django-ndarrayfield-1.0.0rc4.tar.gz.

File metadata

  • Download URL: django-ndarrayfield-1.0.0rc4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.10

File hashes

Hashes for django-ndarrayfield-1.0.0rc4.tar.gz
Algorithm Hash digest
SHA256 90dd4bbb06f8aa002863ffc631163b9deb544b9ce9fdd39d514396df1dcbee11
MD5 fa502bc8162e098c593f5b13a57d9195
BLAKE2b-256 e22ea1f2c8fa64da771a67912201dd713abad2a43e3bfd4624610503a62be332

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page