शब्दों की गिनती

Python में सोशल मीडिया डेटा का विश्लेषण

Alex Hanna

Computational Social Scientist

शब्द क्यों गिनें?

  • टेक्स्ट विश्लेषण को ऑटोमेट करने का मूल कदम
  • दस्तावेजों में किसी कीवर्ड के उल्लेख की संख्या दूसरों से तुलना में बता सकता है
  • अभ्यास में: #rstats बनाम #python
Python में सोशल मीडिया डेटा का विश्लेषण

`str.contains` से गिनती

  • str.contains
    • pandas Series का string मेथड
    • boolean Series लौटाता है
    • case = False - केस-इंसेंसिटिव सर्च
Python में सोशल मीडिया डेटा का विश्लेषण

कंपनियों का डेटासेट

import pandas as pd

tweets = pd.DataFrame(flatten_tweets(companies_json))
apple = tweets['text'].str.contains('apple', case = False)
print(np.sum(apple) / tweets.shape[0])
0.112
Python में सोशल मीडिया डेटा का विश्लेषण

कई टेक्स्ट फ़ील्ड में गिनती

apple = tweets['text'].str.contains('apple', 
                                     case = False) 
for column in ['extended_tweet-full_text',
    'retweeted_status-text',
    'retweeted_status-extended_tweet-full_text']:
    apple = apple | tweets[column].str.contains('apple', 
                                                 case = False)

print(np.sum(apple) / tweets.shape[0])
0.12866666666666668
Python में सोशल मीडिया डेटा का विश्लेषण

अभ्यास करते हैं!

Python में सोशल मीडिया डेटा का विश्लेषण

Preparing Video For Download...