title: Dynamic graph out of realtime data in python
body: <p>I have a pandas dataframe (<code>total_df</code>) that combines a static dataframe (<code>df0</code>) with a dataframe (<code>reduced_rdf</code>) created out of realtime dictionaries (<code>d1</code>). The code is:</p>
  <pre><code>rdf = pd.DataFrame()
  while True:
    for D in (d1):
      rdf1 = pd.DataFrame(d1).T
      reduced_rdf = rdf1[[&quot;from&quot;, &quot;close&quot;, &quot;min&quot;, &quot;max&quot;, &quot;volume&quot;]]
      rdf = pd.concat([rdf, reduced_rdf], ignore_index=True)
      total_df = pd.concat([df0, rdf], ignore_index=True)
    time.sleep(1)
    print(total_df)
  </code></pre>
  <p>However, the output involves several dataframes (each one with one more row):</p>
  <pre><code>             id        from            at  ...      min      max volume
  0     1159393.0  1607434980  1.607435e+18  ...  1.21151  1.21217    287
  1     1159394.0  1607435040  1.607435e+18  ...  1.21175  1.21193    196
  2     1159395.0  1607435100  1.607435e+18  ...   1.2117  1.21188    138
  3     1159396.0  1607435160  1.607435e+18  ...  1.21132  1.21187    177
  4     1159397.0  1607435220  1.607435e+18  ...  1.21127  1.21153    181
  ...         ...         ...           ...  ...      ...      ...    ...
  1996  1161389.0  1607554740  1.607555e+18  ...  1.20806  1.20808      8
  1997  1161390.0  1607554800  1.607555e+18  ...  1.20803  1.20818     84
  1998  1161391.0  1607554860  1.607555e+18  ...  1.20787  1.20807     74
  1999  1161392.0  1607554920  1.607555e+18  ...  1.20778  1.20787     52
  2000        NaN  1607560260           NaN  ...  1.20819  1.20829     35
  
  [2001 rows x 9 columns]
               id        from            at  ...      min      max volume
  0     1159393.0  1607434980  1.607435e+18  ...  1.21151  1.21217    287
  1     1159394.0  1607435040  1.607435e+18  ...  1.21175  1.21193    196
  2     1159395.0  1607435100  1.607435e+18  ...   1.2117  1.21188    138
  3     1159396.0  1607435160  1.607435e+18  ...  1.21132  1.21187    177
  4     1159397.0  1607435220  1.607435e+18  ...  1.21127  1.21153    181
  ...         ...         ...           ...  ...      ...      ...    ...
  1997  1161390.0  1607554800  1.607555e+18  ...  1.20803  1.20818     84
  1998  1161391.0  1607554860  1.607555e+18  ...  1.20787  1.20807     74
  1999  1161392.0  1607554920  1.607555e+18  ...  1.20778  1.20787     52
  2000        NaN  1607560260           NaN  ...  1.20819  1.20829     35
  2001        NaN  1607560260           NaN  ...  1.20819  1.20829     36
  
  [2002 rows x 9 columns]
               id        from            at  ...      min      max volume
  0     1159393.0  1607434980  1.607435e+18  ...  1.21151  1.21217    287
  1     1159394.0  1607435040  1.607435e+18  ...  1.21175  1.21193    196
  2     1159395.0  1607435100  1.607435e+18  ...   1.2117  1.21188    138
  3     1159396.0  1607435160  1.607435e+18  ...  1.21132  1.21187    177
  4     1159397.0  1607435220  1.607435e+18  ...  1.21127  1.21153    181
  ...         ...         ...           ...  ...      ...      ...    ...
  1998  1161391.0  1607554860  1.607555e+18  ...  1.20787  1.20807     74
  1999  1161392.0  1607554920  1.607555e+18  ...  1.20778  1.20787     52
  2000        NaN  1607560260           NaN  ...  1.20819  1.20829     35
  2001        NaN  1607560260           NaN  ...  1.20819  1.20829     36
  2002        NaN  1607560260           NaN  ...  1.20819  1.20829     36
  
  [2003 rows x 9 columns]
  </code></pre>
  <p>My first question is: is there any way to just add one row each time to a single dataframe instead of printing dataframes over and over? Ok, now my second question, how can I create a dynamic graph out of this real-time data? I tried using FuncAnimation function from matplotlib, but I don't know how to integrate that code into the one that I already have. I appreciate your help, thank you.</p>