Skip to content

Verified Users

karenjiang94 edited this page Feb 21, 2018 · 3 revisions

Verified Users

Verified users are definitely their own subclass of Twitter-elite. If we want to do some EDA amongst the Twitter-royalty, we're going to want to filter for that little blue check.

We will be using the users data base reference in the Mongo client twitter account.

mongo_client = MongoClient('this-mongo.cc', 27016)
database_reference = mongo_client.twitter
users_reference = database_reference.users

We will group all users using the verified ID and then count how many are in each group.

ver_groups = pd.DataFrame(list(users_reference.aggregate([
   { GROUP : {
                 "_id" : "$verified",
                 "count" : {"$sum" : 1}
                }
           }
]
)))
_id count
0 True 57740
1 False 1101275

So we have around 1.1 Million plebs and 57K elites. What can we find out about our favorite verified users?

verified = pd.DataFrame(list(users_reference.aggregate([
    {'$match': {'verified' : True }}, 
    {'$group' : { "_id" : "$verified", 'friends_count' : {'$avg' : '$friends_count'} } },
])))
verified
_id friends_count
True 7253.855196
nonverified = pd.DataFrame(list(users_reference.aggregate([
    {'$match': {'verified' : False }}, 
    {'$group' : { "_id" : "$verified", 'friends_count' : {'$avg' : '$friends_count'} } },
])))
nonverified
_id friends_count
False 1648.264315

We can see that our Verified users have over 4 times the amount of friends than non-Verified. (But I guess now comes the question of quality vs. quantity).

Clone this wiki locally