Python tutorials

Integrating MongoDB with Python Using PyMongo

Introduction In this post, we will dive into MongoDB as a data store from a Python perspective. To that end, we’ll write a simple script to showcase what we can achieve and any benefits we can reap from it. Web applications, like many other software applications, are powered by data. The organization and storage of this data are important as they dictate how we interact with the various applications at our disposal. The kind of data handled can also have […]

Read more

Introduction to Image Processing in Python with OpenCV

Introduction In this tutorial, we are going to learn how we can perform image processing using the Python language. We are not going to restrict ourselves to a single library or framework; however, there is one that we will be using the most frequently, the Open CV library. We will start off by talking a little about image processing and then we will move on to see different applications/scenarios where image processing can come in handy. So, let’s begin! What […]

Read more

Removing Stop Words from Strings in Python

In this article, you are going to see different techniques for removing stop words from strings in Python. Stop words are those words in natural language that have a very little meaning, such as “is”, “an”, “the”, etc. Search engines and other enterprise indexing platforms often filter the stop words while fetching results from the database against the user queries. Stop words are often removed from the text before training deep learning and machine learning models since stop words occur […]

Read more

Grid Search Optimization Algorithm in Python

Introduction In this tutorial, we are going to talk about a very powerful optimization (or automation) algorithm, i.e. the Grid Search Algorithm. It is most commonly used for hyperparameter tuning in machine learning models. We will learn how to implement it using Python, as well as apply it in an actual application to see how it can help us choose the best parameters for our model and improve its accuracy. So let’s start. Prerequisites To follow this tutorial, you should […]

Read more

Default Arguments in Python Functions

Functions in Python are used to implement logic that you want to execute repeatedly at different places in your code. You can pass data to these functions via function arguments. In addition to passing arguments to functions via a function call, you can also set default argument values in Python functions. These default values are assigned to function arguments if you do not explicitly pass a parameter value to the given argument. Parameters are the values actually passed to function […]

Read more

Reading and Writing CSV Files in Python with Pandas

There are many ways of reading and writing CSV files in Python. There are a few different methods, for example, you can use Python’s built in open() function to read the CSV (Comma Separated Values) files or you can use Python’s dedicated csv module to read and write CSV files. Depending on your use-case, you can also use Python’s Pandas library to read and write CSV files. In this article, you will see how to use Python’s Pandas library to […]

Read more

Reading and Writing MS Word Files in Python via Python-Docx Module

The MS Word utility from Microsoft Office suite is one of the most commonly used tools for writing text documents, both simple and complex. Though humans can easily read and write MS Word documents, assuming you have the Office software installed, often times you need to read text from Word documents within another application. For instance, if you are developing a natural language processing application in Python that takes MS Word files as input, you will need to read MS […]

Read more

One-Hot Encoding in Python with Pandas and Scikit-Learn

Introduction In computer science, data can be represented in a lot of different ways, and naturally, every single one of them has its advantages as well as disadvantages in certain fields. Since computers are unable to process categorical data as these categories have no meaning for them, this information has to be prepared if we want a computer to be able to process it. This action is called preprocessing. A big part of preprocessing is encoding – representing every single […]

Read more

Unpacking in Python: Beyond Parallel Assignment

Introduction Unpacking in Python refers to an operation that consists of assigning an iterable of values to a tuple (or list) of variables in a single assignment statement. As a complement, the term packing can be used when we collect several values in a single variable using the iterable unpacking operator, *. Historically, Python developers have generically referred to this kind of operation as tuple unpacking. However, since this Python feature has turned out to be quite useful and popular, […]

Read more

The Singleton Design Pattern in Python

Introduction In this article, we’ll be diving into the Singleton Design Pattern, implemented in Python. As time progresses, software gets more tailored to solving specific problems in different domains. While there are many difference in the application-level of our software, some aspects of software design remain largely the same. These aspects might not remain the same for all software out there but will hold true for a lot of scenarios. Therefore, learning and understanding them will be highly beneficial in […]

Read more
1 164 165 166 167 168 181