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)
Thank you.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Obtaining Correct Date In Pandas DataFrame eddywinch82 14 965 Feb-17-2020, 11:45 AM
Last Post: eddywinch82
  Ordering of pandas DataFrame new_to_python 2 114 Feb-08-2020, 01:55 PM
Last Post: new_to_python
  Parse XML String in Pandas Dataframe creedX 2 429 Dec-09-2019, 07:35 PM
Last Post: creedX
  Pandas dataframe to join three tables using like condition among them sandeep_ganga 0 278 Nov-29-2019, 08:30 AM
Last Post: sandeep_ganga
  manipulating a dataframe - pandas nsx200 2 270 Nov-14-2019, 10:38 AM
Last Post: nsx200
  Pandas dataframe columns collapsed in Spyder when printing UniKlixX 2 297 Nov-04-2019, 07:00 AM
Last Post: UniKlixX
  pandas dataframe iloc mystery edvvardbrian 2 353 Oct-29-2019, 02:55 PM
Last Post: jefsummers
  Need help passing date to pandas query curranjohn46 1 451 Oct-10-2019, 09:59 AM
Last Post: curranjohn46
  How to add a few empty rows into a pandas dataframe python_newbie09 2 1,790 Sep-20-2019, 08:52 AM
Last Post: python_newbie09
  Dropping a column from pandas dataframe marco_ita 6 2,069 Sep-07-2019, 08:36 AM
Last Post: marco_ita

Forum Jump:

Users browsing this thread: 1 Guest(s)