-
Notifications
You must be signed in to change notification settings - Fork 2
Type of Device
TO FIND DEVICE TYPES, lets say its not an Android phone: just_geo = {'source' : 1} cursor = collection_reference.find({'source' : {'$regex' : '^((?Android).)*$', '$options' : 'i'}}) cursor.count()
its an Iphone cursor = collection_reference.find({'source' : {'$regex' : '^((IPhone).)*$', '$options' : 'i'}}) cursor.count()
another way to do it
devices = list(set(df['tweet_source'].str.startswith('twitter')]('twitter_source']))
through devices, we will have ['twitter lite', 'twitter web client', 'twitter Ads', twitter for blackberry', 'twitter for window phone', twitter for Android tablets', 'twitter for Mac', 'twitter for Ipad', twitter for windows'. 'twitter for Iphone', 'twitter for Android']
then we remove 'twitter for Ads' by doing devices.remove('twitter Ads') Now, our data set by list: df = df[df['tweet_source'].isin(devices)]