Parse Datetime Strings with parsedatetime in Python

Introduction In this tutorial, we’ll take a look at how to parse Datetime with parsedatetime in Python. To use the parsedatetime package we first need to install it using pip: $ pip install parsedatetime Should pip install parsedatetime fail, the package is also opensource available on Github. Convert String to Python’s Datetime Object with parsedatetime The first, and most common way to use parsedatetime is to parse a string into a datetime object. First, you’ll want to import the parsedatetime […]

Read more

How to Convert DOCX To Html With Python Mammoth

Introduction At some point in your software development path, you’ll have to convert files from one format to another. DOCX (used by Microsoft Word) is a pretty common file format for a lot of people to use. And sometimes, we’d like to convert Word Documents into HTML. This can easily be achieved via the Mammoth package. It’s an easy, efficient, and fast library used to convert DOCX files to HTML. In this article, we’ll learn how to use Mammoth in […]

Read more

How to Rename Pandas DataFrame Column in Python

Introduction Pandas is a Python library for data analysis and manipulation. Almost all operations in pandas revolve around DataFrames. A Dataframe is is an abstract representation of a two-dimensional table which can contain all sorts of data. They also enable us give all the columns names, which is why oftentimes columns are referred to as attributes or fields when using DataFrames. In this article we’ll see how we can rename an already existing DataFrame‘s columns. There are two options for […]

Read more

Python: How to Handle Missing Data in Pandas DataFrame

Introduction Pandas is a Python library for data analysis and manipulation. Almost all operations in pandas revolve around DataFrames, an abstract data structure tailor-made for handling a metric ton of data. In the aforementioned metric ton of data, some of it is bound to be missing for various reasons. Resulting in a missing (null/None/Nan) value in our DataFrame. Which is why, in this article, we’ll be discussing how to handle missing data in a Pandas DataFrame. Data Inspection Real-world datasets […]

Read more

Python: Update All Packages With pip-review

Introduction Updating Python packages can be a hassle. There are many of them – it’s hard to keep track of all the newest versions, and even when you decide what to update, you still have to update each of them manually. To address this issue, pip-review was created. It lets you smoothly manage all available PyPi updates with simple commands. Originally a part of the pip-tools package, it now lives on as a standalone convenience wrapper around pip. In this […]

Read more

Dockerizing Python Applications

Introduction Docker is a widely accepted and used tool by leading IT companies to build, manage and secure their applications. Containers, like Docker, allow developers to isolate and run multiple applications on a single operating system, rather than dedicating a Virtual Machine for each application on the server. The use of these more lightweight containers leads to lower costs, better resource usage, and higher performance. If you’re interested in reading more, you should take a look at Docker: A High […]

Read more

Serving Files with Python’s SimpleHTTPServer Module

Introduction Servers are computer software or hardware that processes requests and deliver data to a client over a network. Various types of servers exist, with the most common ones being web servers, database servers, application servers, and transaction servers. Widely used web servers such as Apache, Monkey, and Jigsaw are quite time-consuming to set up when testing out simple projects and a developer’s focus is shifted from producing application logic to setting up a server. Python’s SimpleHTTPServer module is a […]

Read more

Text Translation with Google Translate API in Python

Unless you have been hiding under a rock, you have probably used Google Translate on many occasions in your life. Whenever you try to translate a word or a sentence from a certain language to another, it is the Google Translate API which brings you the desired results in the background. Though you can translate anything by simply going to the Google Translate web page, you can also integrate Google Translate API into your web applications or desktop programs. The […]

Read more

How to Write a Makefile – Automating Python Setup, Compilation, and Testing

Introduction When you want to run a project that has multiple sources, resources, etc., you need to make sure that all of the code is recompiled before the main program is compiled or run. For example, imagine our software looks something like this: main_program.source -> uses the libraries `math.source` and `draw.source` math.source -> uses the libraries `floating_point_calc.source` and `integer_calc.source` draw.source -> uses the library `opengl.source` So if we make a change in opengl.source for example, we need to recompile both […]

Read more

Managing Python Environments with direnv and pyenv

Introduction As Python developers, most of us are familiar with Virtual Environments. One of the first things we do when working on a new project is to create an environment. We commonly use virtualenv or venv exactly for that purpose. Each project we work on uses different packages and may even be compatible with only one Python version. Doing something repeatedly warrants automation. In this article, we’ll see how direnv and pyenv can help us do that. As a side […]

Read more