'TypeError: join() takes no keyword arguments

I'm trying to concatenate a list of columns based on a condition inside a class. I tried this piece of code outside the class df1[col_list].astype(str).apply("_".join,axis=1)and it is working fine. but inside the class, I'm getting the following error. I really appreciate your help.Thanks

     18         if ('col1' not in self.data.columns) & (len(self.col_list)!=0):
---> 19             self.data["col1"] = self.data[self.col_list].astype(str).apply("_".join, axis=1)
     20 
     21         self.data["col1"] = self.data["col1"].astype("category").cat.codes.values

~\Anaconda3\envs\ta_lib_dev_gluon\lib\site-packages\pandas\core\series.py in apply(self, func, convert_dtype, args, **kwds)
   4211             else:
   4212                 values = self.astype(object)._values
-> 4213                 mapped = lib.map_infer(values, f, convert=convert_dtype)
   4214 
   4215         if len(mapped) and isinstance(mapped[0], Series):

pandas\_libs\lib.pyx in pandas._libs.lib.map_infer()

~\Anaconda3\envs\ta_lib_dev_gluon\lib\site-packages\pandas\core\series.py in f(x)
   4196 
   4197             def f(x):
-> 4198                 return func(x, *args, **kwds)
   4199 
   4200         else:

TypeError: join() takes no keyword arguments


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source