Expected a bytes object, got a 'int' object erro with cudf

el abed houssem picture el abed houssem · Mar 10, 2020 · Viewed 8.8k times · Source

I have a pandas dataframe, all the columns are objects type. I am trying to convert it to cudf by typing cudf.from_pandas(df) but I have this error:

ArrowTypeError: Expected a bytes object, got a 'int' object

I don't understand why even that columns are string and not int. My second question is how to append to a cudf a new element ( like pandas : df. append())

Answer

TaureanDyerNV picture TaureanDyerNV · Mar 10, 2020

cudf does have an df.append() capability for Series.

import cudf
df1 = cudf.DataFrame({'a': [0, 1, 2, 3],'b': [0.1, 0.2, 0.3, 0.4]})
df2 = cudf.DataFrame({'a': [4, 5, 6, 7],'b': [0.1, 0.2, None, 0.3]}) #your new elements
df3= df1.a.append(df2.a)
df3

Output:

0    0
1    1
2    2
3    3
0    4
1    5
2    6
3    7
Name: a, dtype: int64