Python tutorials

A Quick Guide to Text Cleaning Using the nltk Library

This article was published as a part of the Data Science Blogathon. Introduction NLTK is a string processing library that takes strings as input. The output is in the form of either a string or lists of strings. This library provides a lot of algorithms that helps majorly in the learning purpose. One can compare among different variants of outputs. There are other libraries as well like spaCy, CoreNLP, PyNLPI, Polyglot. NLTK and spaCy are most widely used. Spacy works […]

Read more

Words that matter! A Simple Guide to Keyword Extraction in Python

This article was published as a part of the Data Science Blogathon. Introduction Unstructured data contains a plethora of information. It is like energy when harnessed, will create high value for its stakeholders. A lot of work is already being done in this area by various companies. There is no doubt that the unstructured data is noisy and significant work has to be done to clean, analyze, and make them meaningful to use. This article talks about an area which […]

Read more

How to Change Plot Background in Matplotlib

Introduction Matplotlib is one of the most widely used data visualization libraries in Python. From simple to complex visualizations, it’s the go-to library for most. In this tutorial, we’ll take a look at how to change the background of a plot in Matplotlib. Importing Data and Libraries Let’s import the required libraries first. We’ll obviously need Matplotlib, and we’ll use Pandas to read the data: import matplotlib.pyplot as plt import pandas as pd Specifically, we’ll be using the Seattle Weather […]

Read more

Rotate Axis Labels in Matplotlib

Introduction Matplotlib is one of the most widely used data visualization libraries in Python. Much of Matplotlib’s popularity comes from its customization options – you can tweak just about any element from its hierarchy of objects. In this tutorial, we’ll take a look at how to rotate axis text/labels in a Matplotlib plot. Creating a Plot Let’s create a simple plot first: import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 10, 0.1) y = np.sin(x) plt.plot(x, y) […]

Read more

Flask Form Validation with Flask-WTF

Introduction Form validation is one of the most essential components of data entry in web applications. Users can make mistakes, some users are malicious. With input validation, we protect our app from bad data that affects business logic and malicious input meant to harm our systems Trying to process unvalidated user inputs can cause unexpected/unhandled bugs, if not a server crash. In this context, validating data means verifying input and checking if it meets certain expectations or criteria(s). Data validation […]

Read more

A Hands-on Tutorial to Learn Attention Mechanism For Image Caption Generation in Python

Overview Understand the attention mechanism for image caption generation Implement attention mechanism to generate caption in python   Introduction The attention mechanism is a complex cognitive ability that human beings possess. When people receive information, they can consciously ignore some of the main information while ignoring other secondary information. This ability of self-selection is called attention. The attention mechanism allows the neural network to have the ability to focus on its subset of inputs to select specific features.  In recent […]

Read more

Guide to Parsing HTML with BeautifulSoup in Python

Introduction Web scraping is programmatically collecting information from various websites. While there are many libraries and frameworks in various languages that can extract web data, Python has long been a popular choice because of its plethora of options for web scraping. This article will give you a crash course on web scraping in Python with Beautiful Soup – a popular Python library for parsing HTML and XML. Ethical Web Scraping Web scraping is ubiquitous and gives us data as we […]

Read more

How to Plot Inline and With Qt – Matplotlib with IPython/Jupyter Notebooks

Introduction There are a number of different data visualization libraries for Python. Out of all of the libraries, however, Matplotlib is easily the most popular and widely used one. With Matplotlib you can create both simple and complex visualizations. Jupyter notebooks are one of the most popular methods of sharing data science and data analysis projects, code, and visualization. Although you may know how to visualize data with Matplotlib, you may not know how to use Matplotlib in a Jupyter […]

Read more

How to Concatenate Two Lists in Python

Introduction List concatenation the act of creating a single list from multiple smaller lists by daisy chaining them together. There are many ways of concatenating lists in Python. Specifically, in this article, we’ll be going over how to concatenate two lists in Python using the plus operator, unpack operator, multiply operator, manual for loop concatenation, the itertools.chain() function and the inbuilt list method extend(). In all the code snippets below, we’ll make use of the following lists: list_a = [1, […]

Read more

Fine-Grained Sentiment Analysis of Smartphone Review

How to conduct fine-grained sentiment analysis: Approaches and Tools Data collection and preparation. For data collection, we scraped the top 100 smartphone reviews from Amazon using python, selenium, and beautifulsoup library. If you don’t know how to use python and beautifulsoup and request a library for web-scraping here is a quick tutorial. Selenium Python bindings provide a simple API to write functional/acceptance tests using Selenium WebDriver. Let’s begin coding    

Read more
1 137 138 139 140 141 182