title: Django turn pandas dataframe into queryset
body: <p>I have a django app that renders querysets into tables. </p>
  
  <p>I need to perform a few modifications of the underlying querysets and it would be the most convenient to convert the querysets into dataframes, do some magic there and then convert the resulting dataframe back into a queryset so that I can feed it into the existing render. </p>
  
  <p>Converting a queryset into a dataframe seems straightforward, but I ccan't find a way to convert that back.</p>
  
  <pre><code>tables.py
  
  class StuffTable(tables.Table):
      class Meta:
          model = Stuff
          template_name = 'django_tables2/semantic.html'
  
  
  views.py
  
  import django_pandas.io as dpd
  from django_tables2.tables import Table
  from .models import Stuff
  from .tables import StuffTable
  
  def index(request):
  
      context = dict()
      template = 'gui/index.html'
  
      stuff = Stuff.objects.all()
  
      # do pandas stuff with the data
      df = dpd.read_frame(stuff)
      df = ...
      modified_stuff = convert_df_back_to_qs(df) # how to do this?
  
      table = StuffTable(modified_stuff)
      context['table'] = table
  
  return render(request, template, context)
  </code></pre>
  
  <p>How can I do this?</p>
  
  <p>EDIT:
  The reason why I want to convert back is that the html files look like</p>
  
  <pre><code>{% load render_table from django_tables2 %}
  &lt;body&gt;
      {% render_table table %}
  &lt;/body&gt;
  </code></pre>
  
  <p>So, if I can convert the data back into a queryset I would not need to touch any of the html files.</p>