Python中的运行时错误(TypeError:无法隐式地将'float'对象转换为str)

时间:2018-06-04 03:33:30

标签: string python-3.x

 def preprocess(self,max_length=0):
    """Preprocess data
    output: 
    source_input: encoded source input
    target_input: encoded target input
    output: output words encoded"""
    print("Adding start and end tag....")
    for index,row in self.df.iterrows():
        row['Target']='<s> '+row['Target']+' <e>'   
Traceback (most recent call last):
      File "main_bengali_fh.py", line 28, in <module>
        source_input,input_starter,output_encoded = tp.preprocess(max_words)
      File "/home/faisal/translation/text_preprocess_utils_fh.py", line 57, in preprocess
        row['Target']={'<s> '+row['Target']+' <e>'}
    TypeError: Can't convert 'float' object to str implicitly

0 个答案:

没有答案