title: Writing values with multiple tags into influxDB (with python)
body: <p>I’m writing values (floats) to an Influx database with (using DataFrameClient), along with two tags: an ID and a timestamp</p>
  
  <pre><code>def write_to_influx(ID, value):
      df = pandas.DataFrame(data=[value],index=pandas.date_range(start=datetime.utcnow(), periods=1, freq='S'), columns=['value'])
      client.write_points(df, dataPointID, database="mydb")
  </code></pre>
  
  <p>In my loop it happens that I write to the same db consecutively multiple times, like this:</p>
  
  <pre><code>while True:
  
      value_1,value_2,value_3,value_4,value_5 = some_calculation(x,y,z)
  
      write_to_influx(value_1, ID_1)
      write_to_influx(value_2, ID_2)
      write_to_influx(value_3, ID_3)
      write_to_influx(value_4, ID_4)
      write_to_influx(value_5, ID_5)
  </code></pre>
  
  <p>I was told that it's possible to batch these write request into one, which would reduce load on Influx.</p>
  
  <p>I stole the <code>write_to_influx</code> method from another script when actually I have problems grasping this. In the docs it says</p>
  
  <pre><code>write_points(points, time_precision=None, database=None, retention_policy=None, tags=None, batch_size=None, protocol=u'json', consistency=None)
  </code></pre>
  
  <p><em>Parameters:
  points (list of dictionaries, each dictionary represents a point) – the list of points to be written in the database</em></p>
  
  <p>But with <code>write_to_influx(value_1, ID_1)</code>, there is not just a dictionary, but an datapoint ID passed.</p>
  
  <p>Analog to the method already applied and the docu description… If I would like to write multiple values to multiple datapoint IDs, should I pass a list of dictionaries AND a list of datapointIDs ? Because that does not seem to work:</p>
  
  <pre><code>def write_values_to_influx(ID_list, value_list):
  
      indexes=pandas.date_range(start=datetime.utcnow().replace(tzinfo=pytz.UTC), periods=1, freq='S')
  
      dict_list=[]
      for value in value_list:
          df_new= pandas.DataFrame(data=[value],index=indexes)
          dict_list.append(df_new)
  
      client.write_points(dict_list, ID_list, database="mydb")
  </code></pre>
  
  <p>while True:</p>
  
  <pre><code>value_1,value_2,value_3,value_4,value_5 = some_calculation(x,y,z)
  
  ID_list=[ID_1,ID_2,ID_3,ID_4,ID_5]
  value_list=[value_1,value_2,value_3,value_4,value_5]
  
  write_values_to_influx(ID_list, value_list)
  </code></pre>
  
  <p>Returns the error:</p>
  
  <pre><code>File "/vdp/base_functions.py", line 249, in write_values_to_influx
  xyz@crVB    |     client.write_points(dict_list, ID_list, database="mydb")
  xyz@crVB    |   File "/usr/lib/python3.6/site-packages/influxdb/_dataframe_client.py", line 123, in write_points
  xyz@crVB    |     numeric_precision=numeric_precision)
  xyz@crVB    |   File "/usr/lib/python3.6/site-packages/influxdb/_dataframe_client.py", line 282, in _convert_dataframe_to_lines
  xyz@crVB    |     dataframe = dataframe.dropna(how='all').copy()
  </code></pre>
  
  <p><strong>My question:
  How can I write multiple entries at once (to the same db)? Is write_points the write method? And the DataFrameClient?</strong></p>