Python node failing - No serializer extension having the id or processing python type "int"

ghianda-

Marcel’s comment above is right on. I believe the default dtype for pandas get_dummies is np.uint8. You should first try to use the dtype parameter np.int32 (something like below). If that doesn’t work, convert the column(s) dtype(s) as Marcel pointed out. For my dataset, I converted the “by_id” column to a string, but the column could be converted to “int32” (provided the values are all integers) and the node will execute properly.

import pandas as pd
import numpy as np
pd.get_dummies(input_table, dtype=np.int32)

Adriane

1 Like

Thank you Marcel, I got my script working with 2 extra lines at the end:

  1. All integer columns to int 32: df[[‘col1’, ‘col2’,‘col3’]] = df[[‘col1’,‘col2’,‘col3’]].astype(‘int32’)
  2. And not forgetting to reset the index as my df was concatenated multiple times: df = df.reset_index(drop=True)
  3. … and then final output: output_table = df

Note: quickest way to find all integer columns is to run df.dtypes which gives you all columns and their respective types. Mine were actually int64 which was resulting in the error

Thanks again for quick action on this
Vadim

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.