how to replace dot with comma in a column in dask cudf?

12 Views Asked by At

I would like to replace a string column's "." with "," in a dask_cudf dataframe.

example

 tdf = cudf.DataFrame("A":["x.y", "a.b"])
 temp = dask_cudf.from_cudf(tdf, npartitions=1)
 temp["A"] = temp["A"].str.split(".", expand=False)
 temp.head(2)

I got:

  A
0 [x, y]
1 [a, b]

I need:

 A
0  x,y
1  a,b  

I have tried :

  temp  = temp["A"].str.split(".", expand=False).join(sep=",")
  temp.head(2)

I got error:

  "Series" object has no attribute "join".

How can I do this kind of replacement ? thanks

1

There are 1 best solutions below

0
TaureanDyerNV On

don't use split, use str.replace

tdf['A'] = tdf['A'].str.replace('.',',')

outputs:

    A
0   x,y
1   a,b