title: The supplied value is not a valid instance of float. But I'm not asking for a float. Where have I gone wrong?
body: <p>The situation is I am pulling a table through an API into a python dataframe. This dataframe is being pulled directly into a SQL server.
  I'm running into an issue where I encounter an empty string or and empty cell that <em>something</em> expects to be of data type float. Even though I have the table prebuilt in SSMS with not a single float-type column, I'm still getting this error.</p>
  <p>I pulled the same data into a CSV to troubleshoot and we can see that the 78th row of data has an empty cell in the 9th column.
  My python code successfully pushes 77 rows into SQL and then fails. If I simply give the column the type nvarchar then it shouldn't complain when an empty string comes along.</p>
  <p>Can anyone tell me why I'm getting an error with the 12th parameter(When I only have 9 columns) and its desire to be a float, when it should be content with being a string?</p>
  <p>Here as an image showing all the pieces come together, but not quite come together.
  <a href="https://i.stack.imgur.com/TUJhM.jpg" rel="nofollow noreferrer">A lot going on</a></p>
  <p>Here is the code that may be applicable or helpful. I have commented out all the other columns for troubleshooting and did not copy them here.</p>
  <pre><code>for i in range(0, 5):
      now = datetime.now()
      print ('loading stage', i+1, 'of', number_of_locations, 'location:', all_unique_locations[i], ' current time:' , now.strftime (&quot;%H:%M:%S&quot;))
      current_stage = stageSummary.get_stage_summary_by_location_text(access_token, all_unique_locations[i], False )
      df = convert_string_to_dataframe(current_stage)
      all_stage_summary_df = all_stage_summary_df.append(df)
  
  connStr = pyodbc.connect('DRIVER={SQL Server Native Client 11.0};SERVER=&lt;redacted&gt;;DATABASE=AAV_DEVELOPMENT;Trusted_Connection=yes')
  cursor = connStr.cursor()
  
  for index,row in all_stage_summary_df.iterrows():
      print(&quot;Adding row &quot;);
      cursor.execute(&quot;INSERT INTO dbo.StageSummaries([Primary_Location]\
                                                    ,[JobNo]\
                                                    ,[Stage]\
                                                    ,[Top_Depth_m]\
                                                    ,[Elapsed_Time_hh_mm_ss]\
                                                    ,[Start_Time]\
                                                    ,[End_Time]\
                                                    ,[Pumping_Time_hh_mm_ss]\
                                                    ,[Mainline_Pressure_Min_MPa]\
                                                    )values (?,?,?,?,?,?,?,?,?)&quot;
                                                    ,row['Primary Location']
                                                    ,row['JobNo']
                                                    ,row['Stage #']
                                                    ,row['Top Depth (m)']
                                                    ,row['Elapsed Time (hh:mm:ss)']
                                                    ,row['Start Time']
                                                    ,row['End Time']
                                                    ,row['Pumping Time (hh:mm:ss)']
                                                    ,row['Mainline Pressure Min (MPa)']
                                                      ) 
      connStr.commit()
  cursor.close()
  connStr.close()
  </code></pre>
  <p>I have seen a couple of questions with the same error but they don't have alot of detail or solutions that I have found.</p>
  <p>The error</p>
  <pre><code>('42000', '[42000] [Microsoft][SQL Server Native Client 11.0][SQL Server]The incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 12 (&quot;&quot;): The supplied value is not a valid instance of data type float. Check the source data for invalid values. An example of an invalid value is data of numeric type with scale greater than precision. (8023) (SQLExecDirectW)'\)
  </code></pre>