Python tutorials

Matplotlib Bar Plot – Tutorial and Examples

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 plot a bar plot in Matplotlib. Bar graphs display numerical quantities on one axis and categorical variables on the other, letting you see how many occurrences there are for the different categories. Bar charts can be used for visualizing a time series, as well as […]

Read more

Matplotlib: Change Scatter Plot Marker Size

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 change the marker size in a Matplotlib scatter plot. Import Data We’ll use the World Happiness dataset, and compare the Happiness Score against varying features to see what influences perceived happiness in the world: […]

Read more

How to Check if List is Empty in Python

Introduction Lists are one of the four most commonly used data structures provided by Python. Its functionality, extensibility, and ease of use make it useful for implementing various types of functionalities. Python lists have a few interesting characteristics: Mutability – meaning it can change, which means it allows us to easily add and delete entries from it. This is the main difference between Python lists and tuples Homogeneity – meaning all elements within one list have to be of the […]

Read more

Matplotlib Histogram Plot – Tutorial and Examples

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 plot a histogram plot in Matplotlib. Histogram plots are a great way to visualize distributions of data – In a histogram, each bar groups numbers into ranges. Taller bars show that more data falls in that range. A histogram displays the shape and spread of […]

Read more

Convert Bytes to String in Python

Introduction In this article, we’ll take a look at how to convert Bytes to a String in Python. By the end of this article you will have a clear idea of what these types are and how to effectively handle data using them. Depending on the version of Python you’re using, this task will differ. Although Python 2 has reached its end of life, many projects still use it, so we’ll include both the Python 2 and Python 3 approaches. […]

Read more

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
1 135 136 137 138 139 181