Python tutorials

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

Simple NLP in Python with TextBlob: N-Grams Detection

Introduction The constant growth of data on the Internet creates a demand for a tool that could process textual information in a faster way with no effort from the ordinary user. Moreover, it’s highly important that this instrument of text analysis could implement solutions for both low and high-level NLP tasks such as counting word frequencies, calculating sentiment analysis of the texts or detecting patterns in relationships between words. TextBlob is a great lightweight library for a wide variety of […]

Read more

Seaborn Bar 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 Bar Plot in Seaborn. 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 […]

Read more

Reading and Writing XML Files in Python with Pandas

Introduction XML (Extensible Markup Language) is a markup language used to store structured data. The Pandas data analysis library provides functions to read/write data for most of the file types. For example, it includes read_csv() and to_csv() for interacting with CSV files. However, Pandas does not include any methods to read and write XML files. In this article, we will take a look at how we can use other modules to read data from an XML file, and load it […]

Read more

Step by step guide to building sentiment analysis model using graphlab

I have been using graph lab for quite some time now. The first Kaggle competition I used it for was Click Trough Rate (CTR) and I was amazed to see the speed at which it can crunch such big data. Over last few months, I have realised much broader applications of GraphLab. In this article I will take up the text mining capability of GraphLab and solve one of the Kaggle problems. I will be referring to this problem with […]

Read more

Natural Language Processing Made Easy – using SpaCy (​in Python)

Introduction Natural Language Processing is one of the principal areas of Artificial Intelligence. NLP plays a critical role in many intelligent applications such as automated chat bots, article summarizers, multi-lingual translation and opinion identification from data. Every industry which exploits NLP to make sense of unstructured text data, not just demands accuracy, but also swiftness in obtaining results. Natural Language Processing is a capacious field, some of the tasks in nlp are – text classification, entity detection, machine translation, question […]

Read more
1 133 134 135 136 137 181