[Python] Code Example 6 - Lambda & filter function (2)
[Source Code] # Select retweets from the Twitter DataFrame: result result = filter(lambda x : x[0:2] == 'RT', tweets_df['text']) # Create list from filter object result: res_list res_list = list(result) # Print all retweets in res_list for tweet in res_list: print(tweet) [Output] ========================================== <script.py> output: RT @bpolitics: .@krollbondrating's Christopher Whalen says Clinton is the weakest Dem candidate in 50 years https://t.co/pLk7rvoRSn https:/… RT @HeidiAlpine: @dmartosko Cruz video found.....racing from the scene.... #cruzsexscandal https://t.co/zuAPZfQDk3 RT @AlanLohner: The anti-American D.C. elites despise Trump for his America-first foreign policy. Trump threatens their gravy train. https:… RT @BIackPplTweets: Young Donald trump meets his neighbor https://t.co/RFlu17Z1eE RT @trumpresearch: @WaitingInBagd...