This blog will show the code with the help of which i've done sentiment analysis and also made an wordcloud after filtration of language. Applicable for all language. In [3]: import tweepy from tweepy import OAuthHandler import os import re In [5]: consumer_key = "--------------------------------" consumer_secret_key = "-------------------------------------" access_token = "-----------------------------------------------------" access_secret = "------------------------------------------" auth = OAuthHandler(consumer_key, … Continue reading Language-filtered-tweet-Analysis
Author: theone9807
WordCloud-of-tweets-by-@narendramodi
This is the python code used to generate word cloud for all the recent tweets by Narendra Modi G. Follow this code to generate yours word cloud for specific person In [11]: #import modules for api import tweepy from tweepy import OAuthHandler import os In [2]: consumer_key = "---------------------------" consumer_secret_key = "------------------------------------------------" access_token = "------------------------------------------------" access_secret = … Continue reading WordCloud-of-tweets-by-@narendramodi
Object Oriented Programming
Object Oriented Programming (OOP) tends to be one of the major obstacles for beginners when they are first starting to learn Python. There are many, many tutorials and lessons covering OOP so feel free to Google search other lessons, and I have also put some links to other useful tutorials online at the bottom of … Continue reading Object Oriented Programming
*args and **kwargs
Work with Python long enough, and eventually you will encounter *args and **kwargs. These strange terms show up as parameters in function definitions. What do they do? Let's review a simple function: In [1]: def myfunc(a,b): return sum((a,b))*.05 myfunc(40,60) Out[1]: 5.0 This function returns 5% of the sum of a and b. In this example, a … Continue reading *args and **kwargs
Nested Statements and Scope
Now that we have gone over writing our own functions, it's important to understand how Python deals with the variable names you assign. When you create a variable name in Python the name is stored in a name-space. Variable names also have a scope, the scope determines the visibility of that variable name to other … Continue reading Nested Statements and Scope
Lambda Expressions, Map, and Filter
Now its time to quickly learn about two built in functions, filter and map. Once we learn about how these operate, we can learn about the lambda expression, which will come in handy when you begin to develop your skills further! map function The map function allows you to "map" a function to an iterable … Continue reading Lambda Expressions, Map, and Filter
Functions
Introduction to Functions This tutorial will consist of explaining what a function is in Python and how to create one. Functions will be one of our main building blocks when we construct larger and larger amounts of code to solve problems. So what is a function? Formally, a function is a useful device that groups … Continue reading Functions
Methods
We've already seen a few example of methods when learning about Object and Data Structure Types in Python. Methods are essentially functions built into objects. Later on in the course we will learn about how to create our own objects and methods using Object Oriented Programming (OOP) and classes. Methods perform specific actions on an … Continue reading Methods
List Comprehensions
In addition to sequence operations and list methods, Python includes a more advanced operation called a list comprehension. List comprehensions allow us to build out lists using a different notation. You can think of it as essentially a one line for loop built inside of brackets. For a simple example: Example 1 In [1]: # Grab … Continue reading List Comprehensions
Useful Operators
There are a few built-in functions and "operators" in Python that don't fit well into any category, so we will go over them in this lecture, let's begin! range The range function allows you to quickly generate a list of integers, this comes in handy a lot, so take note of how to use it! … Continue reading Useful Operators
