title: How do I import python table data into an sql table?
body: <pre><code>import mysql.connector
  
  mydb = mysql.connector.connect(
      host=&quot;localhost&quot;,
      user=&quot;root&quot;,
      passwd=&quot;password&quot;,
      database=&quot;stocksdatabase&quot;
      )
  mycursor = mydb.cursor()
  
  import yfinance as yf
  ticker = yf.Ticker(&quot;MSFT&quot;)
  hist=ticker.history(period=&quot;max&quot;)
  
  column_str = &quot;&quot;&quot;id, Date, Open, High, 
            Low, Close, Volume, Dividends, Stock Splits&quot;&quot;&quot;
  insert_str = (&quot;%s, &quot; * 9)[:-2]
  final_str = &quot;INSERT INTO historical_price (%s) VALUES (%s)&quot; % (column_str, insert_str)
  
  mycursor.execute(final_str, hist)
  mydb.commit()
  </code></pre>
  <p>I get the error &quot;The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().&quot;</p>
  <p>How can I approach this?</p>