title: Error Loading DataFrame to BigQuery Table (pyarrow.lib.ArrowTypeError: object of type <class 'str'> cannot be converted to int)
body: <p>I have a CSV stored in GCS which I want to load it to BigQuery table. But I need to do some pre-process first so I load it to DataFrame and later load to BigQuery table</p>
  <pre><code>import pandas as pd
  import json 
  from google.cloud import bigquery
  
  
  cols_name_list = [....]. # column name in order
  uri = &quot;gs://&lt;bucket&gt;/&lt;path&gt;/&lt;csv_file&gt;&quot;
  df = pd.read_csv(uri, dtype=&quot;string&quot;)
  df =df.reindex(columns=cols_name_list)
  
  client = bigquery.Client()
  job_config = bigquery.LoadJobConfig(
     ... # added all schema field according to table column type
  )
  
  job = client.load_table_from_dataframe(
      df, &quot;&lt;bq_table_id&gt;&quot;, job_config=job_config
  )
  job.result()
  </code></pre>
  <p>From code above, I reorder the dataframe column order to match with the order in BigQuery table (not sure if this matter or not) and convert all column to be string type.</p>
  <p>I got this error as shown below in which</p>
  <pre><code>pyarrow.lib.ArrowInvalid: Could not convert '47803' with type str: tried to convert to int
  </code></pre>
  <p>I also ran it without forcing the dtypes to be string and I got another error</p>
  <pre><code>pyarrow.lib.ArrowTypeError: Expected a string or bytes dtype, got int64
  </code></pre>
  <p>The code and data looks normal. So, I tried downgrading the version of numpy and pyarrow and still cause the same error.</p>
  <p><strong>Update:</strong></p>
  <p>I updated the code to force only string column</p>
  <pre><code>df =pd.read_csv(uri, dtype={&quot;B&quot; : &quot;string&quot;})
  </code></pre>
  <p>This is the example CSV data that I worked with</p>
  <pre><code>A,B,C,D,E,F,G
  47803,000000000020030263,629,,2021-01-12 23:26:37,,
  </code></pre>
  <p>where column type of BQ table should be like this</p>
  <pre><code>job_config = bigquery.LoadJobConfig(
      schema = [
          bigquery.SchemaField(&quot;A&quot;, &quot;INTEGER&quot;),
          bigquery.SchemaField(&quot;B&quot;, &quot;STRING&quot;),
          bigquery.SchemaField(&quot;C&quot;, &quot;INTEGER&quot;),
          bigquery.SchemaField(&quot;D&quot;, &quot;INTEGER&quot;),
          bigquery.SchemaField(&quot;E&quot;, &quot;DATETIME&quot;),
          bigquery.SchemaField(&quot;F&quot;, &quot;INTEGER&quot;),
          bigquery.SchemaField(&quot;G&quot;, &quot;DATETIME&quot;)
      ]
  )
  </code></pre>
  <p>Now, when I'm trying to load data with <code>load_table_from_dataframe()</code> with these configs, I got this error</p>
  <pre><code>pyarrow.lib.ArrowTypeError: object of type &lt;class 'str'&gt; cannot be converted to int
  </code></pre>
  <p>So, I print the dtypes out</p>
  <pre><code>A      int64
  B      string
  C      int64
  D      float64
  E      object
  F      float64
  G      float64
  dtype: object
  </code></pre>
  <p>Which column that is the issue right now and how can I fix this? The error is not quite useful for debugging. Since the column that supposed to be int is already int. The only column with string type no need to be converted to int but the error thrown like that</p>