Python tutorials

Matplotlib Line 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 line plot in Matplotlib – one of the most basic types of plots. Line Plots display numerical values one one axis, and categorical values on the other. They can typically be used in much the same way Bar Plots can be used, though, […]

Read more

Matplotlib Violin Plot – Tutorial and Examples

Introduction There are many data visualization libraries in Python, yet Matplotlib is the most popular library out of all of them. Matplotlib’s popularity is due to its reliability and utility – it’s able to create both simple and complex plots with little code. You can also customize the plots in a variety of ways. In this tutorial, we’ll cover how to plot Violin Plots in Matplotlib. Violin plots are used to visualize data distributions, displaying the range, median, and distribution […]

Read more

How to Upload Files with Python’s requests Library

Introduction Python is supported by many libraries which simplify data transfer over HTTP. The requests library is one of the most popular Python packages as it’s heavily used in web scraping. It’s also popular for interacting with servers! The library makes it easy to upload data in a popular format like JSON, but also makes it easy to upload files as well. In this tutorial, we will take a look at how to upload files using Python’s requests library. The […]

Read more

Seaborn Violin Plot – Tutorial and Examples

Introduction Seaborn is one of the most widely used data visualization libraries in Python, as an extension to Matplotlib. It offers a simple, intuitive, yet highly customizable API for data visualization. In this tutorial, we’ll take a look at how to plot a Violin Plot in Seaborn. Violin plots are used to visualize data distributions, displaying the range, median, and distribution of the data. Violin plots show the same summary statistics as box plots, but they also include Kernel Density […]

Read more

Spelling Correction in Python with TextBlob

Introduction Spelling mistakes are common, and most people are used to software indicating if a mistake was made. From autocorrect on our phones, to red underlining in text editors, spell checking is an essential feature for many different products. The first program to implement spell checking was written in 1971 for the DEC PDP-10. Called SPELL, it was capable of performing only simple comparisons of words and detecting one or two letter differences. As hardware and software advanced, so have […]

Read more

Jump Search in Python

Introduction Finding the right data we need is an age-old problem before computers. As developers, we create many search algorithms to retrieve data efficiently. Search algorithms can be divided into two broad categories: sequential and interval searches. Sequential searches check each element in a data structure. Interval searches check various points of the data (called intervals), reducing the time it takes to find an item, given a sorted dataset. In this article, you will cover Jump Search in Python – […]

Read more

Python: Check if Key Exists in Dictionary

Introduction Dictionary (also known as ‘map’, ‘hash’ or ‘associative array’) is a built-in Python container that stores elements as a key-value pair. Just like other containers have numeric indexing, here we use keys as indexes. Keys can be numeric or string values. However, no mutable sequence or object can be used as a key, like a list. In this article, we’ll take a look at how to check if a key exists in a dictionary in Python. In the examples, […]

Read more

Calculating Pearson Correlation Coefficient in Python with Numpy

Introduction This article is an introduction to the Pearson Correlation Coefficient, its manual calculation and its computation via Python’s numpy module. The Pearson correlation coefficient measures the linear association between variables. Its value can be interpreted like so: +1 – Complete positive correlation +0.8 – Strong positive correlation +0.6 – Moderate positive correlation 0 – no correlation whatsoever -0.6 – Moderate negative correlation -0.8 – Strong negative correlation -1 – Complete negative correlation We’ll illustrate how the correlation coefficient varies […]

Read more

How to Merge Two Dictionaries in Python

Introduction It’s not uncommon to have two dictionaries in Python which you’d like to combine. In this article, we will take a look at various ways on how to merge two dictionaries in Python. Some solutions are not available to all Python versions, so we will examine ways to merge for selected releases too. When merging dictionaries, we have to consider what will happen when the two dictionaries have the same keys. Let’s first define what should happen when we […]

Read more

Creating Executable Files from Python Scripts with py2exe

Introduction Executing Python scripts requires a lot of prerequisites like having Python installed, having a plethora of modules installed, using the command line, etc. while executing an .exe file is very straightforward. If you want to create a simple application and distribute it to lots of users, writing it as a short Python script is not difficult, but assumes that the users know how to run the script and have Python already installed on their machine. Examples like this show […]

Read more
1 134 135 136 137 138 182