我正在尝试绘制pandas中一列文本中字符的分布。例如:
Phrase
example1
example1+example2
example 3
example 4
example of sentence
and so on....
所以我需要确定Phrase
列中每个字符串/文本的长度。计算
df['Phrases length'] = df.Phrase.apply(len)
但后来我意识到我不知道如何绘制长度分布。我希望你能提供一些帮助或建议。
通常使用直方图绘制分布。在您的情况下,它可以像这样:
sns.displot(df,x='Phrases length')
在这里查看更多文档。