所以基本上我是在分析instagram账户。我已经使用selenium刮过intagram,并创建了一个数据栏,其中包括到post的链接、喜欢的数量和使用的哈希标签。因此,在数据框架中,我已经将list对象包含在一个cloumn中,并且我希望找到总计使用的唯一哈希标签的计数。
这就是这个数据文件的样子。
links ... hashtags
0 https://www.instagram.com/p/CLrU5s5g7L7/ ... [#data, #datascience, #technology, #machinelea...
1 https://www.instagram.com/p/CLojnLQgEVs/ ... [#datascience, #machinelearning, #python, #art...
2 https://www.instagram.com/p/CLjhzPxgpkM/ ... [#python, #AI, #ML, #artificialintelligence, #...
3 https://www.instagram.com/p/CLgUsXAgOah/ ... [#datascience, #machinelearning, #python, #art...
4 https://www.instagram.com/p/CLdfVBHAibb/ ... [#billgates, #softwareengineering, #softwareen...
5 https://www.instagram.com/p/CLbGqrYgl74/ ... [#python3, #python, #pythonprogramming, #AI, #...
6 https://www.instagram.com/p/CLZKOEcg72M/ ... [#python3, #python, #pythonprogramming, #AI, #...
7 https://www.instagram.com/p/CLYe9AJgg0U/ ... [#datascience, #machinelearning, #python, #art...
8 https://www.instagram.com/p/CLV4UP5Af-2/ ... [#pawrihoraihai, #programming, #coding, #progr...
9 https://www.instagram.com/p/CLTSxc5g2cJ/ ... [#datascience, #machinelearning, #python, #art..我已经将哈希标记存储为与相应的post对应的list对象。有没有更好的方法来存储标签呢?以及如何获得整体使用的唯一标签的计数。
提前谢谢!!
发布于 2021-02-25 15:06:39
这里有一种使用Counter的方法
from collections import Counter
arr = df['hashtags'].apply(pd.Series).values.ravel() # Consolidate all hashtags
count_dict = Counter(arr)https://stackoverflow.com/questions/66370453
复制相似问题