0

Im reading a csv file and filtering data from that file to input this date into a google sheet but everytime i try to input the data into a google sheets it gives me this error:

TypeError: Object of type time is not JSON serializable

So I have tried to convert all my time to a string using the code bellow Here is the result of running a dtype on the dataframe before I changed data to string.

Matrícula                int64
Chave                    int64
Nome_Willer             object
Supervisor_             object
Coordenador_            object
Data            datetime64[ns]
Status_w                object
Aderência              float64
Extra                   object
Status                  object
Mês                     object
dtype: object


abs['Data'] = abs['Data'].dt.strftime('%Y%m%d%H%M%S') 

here is after I changed it to string format

Matrícula         int64
Chave             int64
Nome_Willer      object
Supervisor_      object
Coordenador_     object
Data             object
Status_w         object
Aderência       float64
Extra            object
Status           object
Mês              object
dtype: object

Iam using this code to input the data i have filtered in to googlesheets

def updating(x,y):
    x.update([y.columns.values.tolist()]+ y.values.tolist())

I created a function that adds the data in to google sheets. X is the name of the sheet in the spreadsheet and y is the new dataframe with the filtered data.

Here is a print of the original dataframe.

  • Please don't post images of code, errors, or other text; see [ask]. A [mcve] would probably help. – Robert May 18 '22 at 14:06
  • Does this answer your question? [jsonpickle datetime to readable json format](https://stackoverflow.com/questions/19414672/jsonpickle-datetime-to-readable-json-format) – BoarGules May 20 '22 at 06:52

0 Answers0