title: How to print value of list in Python (array[25,65], array[25,42], array[25,24]) to (25.65, 25.42, 25,24)
body: <p>We're working on a python program, where we have trouble sending data to our MySQL database. So far, we are selecting data from our database and we want to do something with the data in our python program and then send it back to our database. </p>
  
  <p>Unfortunately, we're having some challenges, which we hope you can help us with.</p>
  
  <p>We're receiving this error: </p>
  
  <pre><code>[SQL: INSERT INTO `Raw_Validated` (time_start, time_end, first_temp_lpn, first_temp_lpn_validated, second_temp_lpn, second_temp_lpn_validated, third_temp_lpn, third_temp_lpn_validated) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)]
  [parameters: ('2019-08-29 16:20:00', '2019-08-29 17:20:00', array([25.69]), 1, array([25.21]), 1, array([25.09]), 1)]
  </code></pre>
  
  <p>And we can conclude that instead of inserting a value, an array is inserted. We have no idea why this is happening or how we can prevent this, but instead of the parameters above, we want it to become like this: </p>
  
  <pre><code>[parameters: ('2019-08-29 16:20:00', '2019-08-29 17:20:00', 25.69, 1, 25.21, 1, 25.09, 1)]
  </code></pre>
  
  <p>We're running a for loop which iterate 3x times, which means we are receiving 3x 'a_temp' values, which are saved into our list 'list_lpn_temp (for-loop is not shown in code snippet):</p>
  
  <pre><code>list_lpn_temp = []
  new_list_lpn_temp = []
  
  engine = create_engine("mysql://xxx:xxx@localhost/xxx")
  conn = engine.connect()
  
  a_temp = pd.read_sql('SELECT temperature FROM Raw_Data WHERE topic = "lpn1" AND timestamp &gt; "%s" AND timestamp &lt; "%s" ORDER BY timestamp DESC LIMIT 1' % (x, x+datetime.timedelta(minutes=20)), conn).astype(float).values
  
  list_lpn_temp.extend(a_temp)
  </code></pre>
  
  <p>We then have another for loop (keep in mind that list_station has not been initialized, but in our program it has been): </p>
  
  <pre><code>for i in range (len(list_lpn_temp)):
  if -1.5 &lt; list_station_temp[i]-list_lpn_temp[i] &lt; 1.5:
      validated_lpn = 1
      list_validated.append(validated_lpn)
      new_list_lpn_temp.extend(list_lpn_temp[i]) 
      print(f'New LPN List = {new_list_lpn_temp}')
  else:
      validated_lpn = 0
      list_validated.append(validated_lpn)
  </code></pre>
  
  <p>We then prepare the data so we can send it further to the database (there are a lot of new uninitialized variables here, which we have initialized in our program, but not here, as they simply dont matter). Only list_lpn_temp[] matters here:</p>
  
  <pre><code>df2 = pd.DataFrame(columns=['time_start', 'time_end', 'first_temp_lpn', 'first_temp_lpn_validated', 'second_temp_lpn', 'second_temp_lpn_validated', 'third_temp_lpn', 'third_temp_lpn_validated'])
  df2 = df2.append({'time_start' : time_start, 'time_end' : time_end, 'first_temp_lpn' : list_lpn_temp[0], 'first_temp_lpn_validated' : list_validated[0], 'second_temp_lpn' : list_lpn_temp[1], 'second_temp_lpn_validated' : list_validated[1$
  
  with engine.connect() as conn, conn.begin():
      df2.to_sql('Raw_Validated', conn, if_exists='append', index=False)
  </code></pre>