2021年4月28日星期三

float' object is not iterable

I'm trying to clean a column of abstract in a dataset

this is the cleaning function I'm using

#remove punctuations  def remove_punctuation (text):      no_punct="".join([c for c in text if c not in string.punctuation])      return no_punct  

when I wrtite the line

df['abstract'] = df['abstract'].apply(lambda x: remove_punctuation(x))  

I get 'float' object is not iterable

when column abstract is of type string.

Can anybody explain it does not work?

https://stackoverflow.com/questions/67310457/float-object-is-not-iterable April 29, 2021 at 11:03AM

没有评论:

发表评论