Thomas Kremmel
Thomas Kremmel

Reputation: 14783

Django Python Timeseries - Reusable app and data base schema

Which Django apps or Python modules are to be recommended for handling and saving into a DB timeseries data. Which database schema is to be recommended for the time series data?

My use case is that I have node models in my db schema having a start and end date, and I want to save for each day between start and end date a value. This can be quite a lot of rows as I have thousands of nodes, and start and end dates are between 1 and 365 days.

My models would look like this, whereas I would be thankful for input regarding a better / performance improved structure:

class Node(models.Model):
    """
    Representation of a single node
    """

    name = models.CharField(max_length=200)
    start = models.DateField() 
    end = models.DateField()

class TimeSeries(models.Model)
     """
     holds the time series values. For each day between start and end date one TimeSeries object will be created
     """
     node = models.ForeignKey(Node)
     date = models.DateField() #holds a specific date between start and end date of node
     value = models.IntegerField(max_length=2)

Upvotes: 2

Views: 2050

Answers (1)

Ram Narasimhan
Ram Narasimhan

Reputation: 22506

I'd say your best bet is Pandas. They take the best of NumPy, scikits etc. and package it.

  1. Pandas' Time Series functionality. Even though the pyTseries is no longer active (merged into Pandas) the documentation is good to browse.
  2. If ARMA is of interest, check out these sets of "statsmodels."

Hope this helps.

Upvotes: 1

Related Questions