Python 绘制字符分布图

Python 绘制字符分布图,python,pandas,matplotlib,seaborn,Python,Pandas,Matplotlib,Seaborn,我试图在《熊猫》的一个专栏中描绘文字的分布。 例如: Phrase example1 example1+example2 example 3 example 4 example of sentence and so on.... 因此,我需要确定短语列中每个字符串/文本的长度。 计算 df['Phrases length'] = df.Phrase.apply(len) 但后来我意识到我不知道如何绘制长度分布。 我希望您能在这方面提供一些帮助或建议。您通常使用直方图绘制分布。在您的情况下,

我试图在《熊猫》的一个专栏中描绘文字的分布。 例如:

Phrase
example1
example1+example2
example 3 
example 4
example of sentence
and so on....
因此,我需要确定
短语
列中每个字符串/文本的长度。 计算

df['Phrases length'] = df.Phrase.apply(len)
但后来我意识到我不知道如何绘制长度分布。
我希望您能在这方面提供一些帮助或建议。

您通常使用直方图绘制分布。在您的情况下,可能是这样的:

sns.displot(df,x='Phrases length')

查看更多文档。

谢谢分隔符。它正在生成大量/anaconda3/lib/python3.7/site packages/matplotlib/backends/backend_agg.py:238:RuntimeWarning:Glyph 9659缺少当前字体。这正常吗?这肯定不正常,可能是特定于您的环境的,例如Matplotlib的安装方式。