Python tutorials

Validating and Formatting Phone Numbers in Python with phonenumbers

Introduction Validating phone numbers can be a very challenging task. The format of a phone number can vary from one country to another. Heck, it can also vary within the same country! Some countries share the same country code, while some other countries use more than one country code. According to an example from the Google’s libphonenumber GitHub repository, USA, Canada, and Caribbean islands, all share the same country code (+1). On the other hand, it is possible to call […]

Read more

Python AI: How to Build a Neural Network & Make Predictions

If you’re just starting out in the artificial intelligence (AI) world, then Python is a great language to learn since most of the tools are built using it. Deep learning is a technique used to make predictions using data, and it heavily relies on neural networks. Today, you’ll learn how to build a neural network from scratch. In a production setting, you would use a deep learning framework like TensorFlow or PyTorch instead of building your own neural network. That […]

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

Python Community Interview With Ewa Jodlowska

Today I’m joined by Ewa Jodlowska, executive director of the Python Software Foundation (PSF), the organization devoted to advancing open source technology related to the Python programming language. In this interview, we discuss how Ewa started her tech journey, how COVID-19 affected the PSF, plans for PyCon US 2021, her love of hiking and lifting weights, and much more. Ricky: Thank you for joining me, Ewa. You’ve been at the PSF for over nine years at this point, first as […]

Read more

Python: How to Print Without Newline or Space

Introduction The print() function in Python appends a newline to the output when displayed on the tty (teletypewriter A.K.A the terminal). When you don’t want your message displayed with newlines or with spaces, how can you change the behavior of print()? This can easily be achieved by altering the default values of the sep and end parameters of the print() function. Printing Without a Newline Until Python version 2.x, print was a reserved keyword that acts as a special statement. […]

Read more

How to Split a List Into Even Chunks in Python

Introduction Splitting strings and lists are common programming activities in Python and other languages. Sometimes we have to split our data in peculiar ways, but more commonly – into even chunks. The language does not have a built-in function to do this and in this tutorial, we’ll take a look at how to split a list into even chunks in Python. For most cases, you can get by using generators: def chunk_using_generators(lst, n): for i in range(0, len(lst), n): yield […]

Read more

Language Detection Using Natural Language Processing

Introduction Every Machine Learning enthusiast has a dream of building/working on a cool project, isn’t it? Mere understandings of the theory aren’t enough, you need to work on projects, try to deploy them, and learn from them. Moreover, working on specific domains like NLP gives you wide opportunities and problem statements to explore. Through this article, I wish to introduce you to an amazing project, the Language Detection model using Natural Language Processing. This will take you through a real-world […]

Read more

Build a Contact Book With Python, PyQt, and SQLite

Building projects is arguably one of the more approachable and effective ways of learning to program. Real projects require you to apply different and varied coding skills. They also encourage you to research topics that pop up as you’re solving problems in the development process. In this tutorial, you’ll create a contact book application with Python, PyQt, and SQLite. In this tutorial, you’ll learn how to: Create a graphical user interface (GUI) for your contact book application using Python and […]

Read more

How to Sort a Pandas DataFrame by Date

Introduction Pandas is an extremely popular data manipulation and analysis library. It’s the go-to tool for loading in and analyzing datasets for many. Correctly sorting data is a crucial element of many tasks regarding data analysis. In this tutorial, we’ll take a look at how to sort a Pandas DataFrame by date. Let’s start off with making a simple DataFrame with a few dates: import pandas as pd data = {‘Name’:[“John”, “Paul”, “Dhilan”, “Bob”, “Henry”], ‘Date of Birth’: [“01/06/86”, “05/10/77”, […]

Read more
1 125 126 127 128 129 181