title: Saving a Pandas DataFrame to a Django Model
body: <p>I have stock price data that is stored in a pandas DataFrame as shown below (actually it was in a panel, but I converted it to a DataFrame)</p>
  
  <pre><code>        date  ticker  close       tsr
  0 2013-03-28  abc     22.81  1.000439
  1 2013-03-28  def     94.21  1.006947
  2 2013-03-28  ghi     95.84  1.014180
  3 2013-03-28  jkl     31.80  1.000000
  4 2013-03-28  mno     32.10  1.003125
  ...many more rows
  </code></pre>
  
  <p>I want to save this in a Django model, which looks like this (matches the column names):</p>
  
  <pre><code>class HistoricalPrices(models.Model):
      ticker = models.CharField(max_length=10)
      date = models.DateField()
      tsr = models.DecimalField()
      close = models.DecimalField()
  </code></pre>
  
  <p>The best I've come up so far is using this to save it, where df is my DataFrame:</p>
  
  <pre><code>entries = []
  for e in df.T.to_dict().values():
      entries.append(HistoricalPrices(**e))
  HistoricalPrices.objects.bulk_create(entries)
  </code></pre>
  
  <p>Is there a better way to save this?</p>
  
  <p>I've looked at <a href="http://django-pandas.readthedocs.io/en/latest/" rel="noreferrer">django-pandas</a>, but looks like it just reads from the DB.</p>