1 year ago

#360392

test-img

Ashish

TypeError: expected string or bytes-like object in wordcloud in pyhon

I am trying to build wordcloud using WordCloud funtion in Python using following syntax

df = sql_query1
df.isna().sum()
word_cloud2 = WordCloud(collocations = False, background_color = 'white').generate(df["BankComment"])

it throws following error

TypeError: expected string or bytes-like object

i tried to convert bankComment to string using following methods

df["BankComment"] = df["BankComment"].replace("/"," ")
df["BankComment"] = df["BankComment"].apply(lambda x: str(x))

but nothing worked
following are entries

|/BAI/469/BAI/REF-6215077H0196 /ENTRY-18 MAR PO...|
|/BAI/469/BAI/REF-6215077H0218 /ENTRY-18 MAR PO...\|

python

word-cloud

0 Answers

Your Answer

Accepted video resources