【问题标题】:Plot Tweets Length is not clear why the length has high valuesPlot Tweets 长度不清楚为什么长度具有高值
【发布时间】:2022-08-03 21:37:36
【问题描述】:

我想澄清一下,因为我想知道为什么推文长度到达 800 时,推文文本可以或可以有 280(更少或更多)字符? 做这个脚本我有这个面板。也许我错了。也许我也有 len 内的空间计数?

# Exploring the text lengths
lunghezza =  df[\'text\'].astype(str).apply(len)
# visualize the text length
plt.figure(figsize=(50,44))
plt.xticks(fontsize=80)
plt.yticks(fontsize=80)  
plt.hist(lunghezza, edgecolor = \"black\", color=\'darkturquoise\');
plt.grid(True, color=\'gray\', linestyle=\'dashed\', linewidth=0.5, axis=\'y\')
# Define x-axis label
plt.xlabel(\"Length Tweets\", fontsize=80)

# Define y-label
plt.ylabel(\"Number Tweets\",fontsize=80)
plt.suptitle(\'Visualize the text length\', fontsize=90)

    标签: python plot text nlp


    【解决方案1】:

    我们很难确切地说,因为我们看不到您的数据。但是当你这样做时你会看到什么:

    df['text'].astype(str).apply(len).sort_values().head(10)
    

    这应该会给你那些长度最长的推文。检查发生了什么以及数据的外观。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-07-01
      • 2019-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-07
      • 2020-07-05
      • 1970-01-01
      相关资源
      最近更新 更多