Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Pandas Dataframe to Google Big Query

Just when I almost get it, it slips away.

I have a dataframe that I would like to put into a google big query table.
However (aha) as per normal, when I try it, it just errors (pyarrow cannot convert byte to intger on an object/string).

So I thought I would try to force a type on a column on the dataframe to see if that would allow it to go up.
Can't even get that to work.
    'year':'theyear', 'month':'themonth', 
    }, axis='columns',inplace=True)
df[ 'dateofprocesing' ] = None
df[ 'publisherid' ] = 0
df[ 'siteid' ] = 0
df.astype([{'theyear':'int64'},{'themonth':'int64'}], copy=False, errors='raise')

The month and the year should all be numbers, but appears it has been assigned an object (assuming string)

How do I change the type of the column..?
If you would have looked here you´d seen that you need to provide a dictionary and not a list of column names.
df.astype({'theyear':'int64', 'themonth':'int64'}, copy=False)

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How to add a few empty rows into a pandas dataframe python_newbie09 2 126 Sep-20-2019, 08:52 AM
Last Post: python_newbie09
  Dropping a column from pandas dataframe marco_ita 6 321 Sep-07-2019, 08:36 AM
Last Post: marco_ita
  created a pandas series instead of pandas DataFrame ibaad1406 6 384 Sep-06-2019, 06:23 AM
Last Post: ibaad1406
  Applying operation to a pandas multi index dataframe subgroup Nuovoq 1 197 Sep-04-2019, 10:04 PM
Last Post: Nuovoq
  Substr on Pandas Dataframe Scott 1 267 Sep-02-2019, 02:49 AM
Last Post: scidam
  how to apply user defined function to Pandas DataFrame evelynow 3 461 Aug-20-2019, 11:35 PM
Last Post: scidam
  Create dataframe through Dictionary in pandas ift38375 2 175 Aug-11-2019, 01:09 AM
Last Post: boring_accountant
  [pandas] How to re-arrange DataFrame columns SriMekala 8 787 Jun-22-2019, 12:55 AM
Last Post: scidam
  Pandas - updating the original dataframe with sub selects Ecniv 0 203 Jun-21-2019, 02:12 PM
Last Post: Ecniv
  Simple String to Time within a pandas dataframe Ecniv 1 544 Jun-14-2019, 03:25 AM
Last Post: scidam

Forum Jump:

Users browsing this thread: 1 Guest(s)