def getData(self, params): top = int(params['top']) df = extract.createDataframe() #tweet_by_country = df[df['country'] != 'no text'] tweet_by_country = df['country'].value_counts() country = [item for item in tweet_by_country.keys()] count = [item for item in tweet_by_country] tweet_by_country = pd.DataFrame({'Country':country, 'Count': count}) tweet_by_country = tweet_by_country[['Country', 'Count']] return tweet_by_country[:top]
def getData(self, params): top = int(params['top']) regex = re.compile('^<.*>(\w+.*)</.>') df = createDataframe() source = [str(regex.findall(line)).strip('[]') for line in df['source'] if line != None] source = dict(Counter(source)) appSource = source.keys() count = source.values() tweetSource = DataFrame({'AppSource': appSource, 'Count':count}) tweetSource = tweetSource[['AppSource', 'Count']] tweetSource.sort_values(by='Count', ascending=False, inplace=True) return tweetSource[:top]
def getData(self, params): top = int(params['top']) df = extract.createDataframe() df.sort_values(by='followers_count', ascending=False, inplace=True) df2 = df[['screen_name','followers_count', 'friends_count']] return df2[:top]
def getData(self, params): '''Return dataframe ''' range = int(params['range']) df = extract.createDataframe() df = df[['followers_count', 'friends_count']] return df[:range]