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
  Dropping a column from pandas dataframe marco_ita 6 281 Sep-07-2019, 08:36 AM
Last Post: marco_ita
  created a pandas series instead of pandas DataFrame ibaad1406 6 360 Sep-06-2019, 06:23 AM
Last Post: ibaad1406
  Applying operation to a pandas multi index dataframe subgroup Nuovoq 1 181 Sep-04-2019, 10:04 PM
Last Post: Nuovoq
  Substr on Pandas Dataframe Scott 1 248 Sep-02-2019, 02:49 AM
Last Post: scidam
  how to apply user defined function to Pandas DataFrame evelynow 3 441 Aug-20-2019, 11:35 PM
Last Post: scidam
  Create dataframe through Dictionary in pandas ift38375 2 171 Aug-11-2019, 01:09 AM
Last Post: boring_accountant
  [pandas] How to re-arrange DataFrame columns SriMekala 8 780 Jun-22-2019, 12:55 AM
Last Post: scidam
  Pandas - updating the original dataframe with sub selects Ecniv 0 201 Jun-21-2019, 02:12 PM
Last Post: Ecniv
  Simple String to Time within a pandas dataframe Ecniv 1 542 Jun-14-2019, 03:25 AM
Last Post: scidam
  Is there any way to properly load fixed width file into a dataframe using Pandas? vicky53 1 351 Mar-29-2019, 06:04 PM
Last Post: Larz60+

Forum Jump:

Users browsing this thread: 1 Guest(s)