Freelance Python Developer
How to Sort a Dictionary by Value in Python
A dictionary in Python is a collection of items that stores data as key-value pairs. In Python 3.7 and later versions, dictionaries are sorted by the order of item insertion. In earlier versions, they were unordered. In this article, we'll take a look at how we can sort a...
Creating a REST API with Django REST Framework
REST APIs are an industry-standard way for web services to send and receive data. They use HTTP request methods to facilitate the request-response cycle and typically transfer data using JSON, and more rarely - HTML, XML and other formats. In this guide, we will create a REST API in Python...
Python: How to Remove a Character from a String
In this guide, we'll take a look at how to remove a character from a string in Python. Strings, and especially user-generated input may contain unwanted characters, such as special characters in a username field we don't want to store. In those cases, we might prefer to remove specific characters...
Creating a REST API in Python with Django
Django is a powerful Python Web Framework used to build secure, scalable web applications rapidly with fewer efforts. It became popular because of its low barrier to entry, and strong community that uses and develops the framework. In this guide, we are going to build a RESTful API using Django...
Python: Check if Variable is a Dictionary
Variables act as a container to store data. A developer can use type hints when creating variables or passing arguments, however, that's an optional feature in Python, and many codebases, old and new, are yet to have them. It's more common for a variable in Python to have no information...
Python: How to Add Key to a Dictionary
A dictionary in Python is a collection of items that store data as key-value pairs. We can access and manipulate dictionary items based on their key. Dictionaries are mutable and allow us to add new items to them. The quickest way to add a single item to a dictionary is...
Reading and Writing HTML Tables with Pandas
Hypertext Markup Language (HTML) is the standard markup language for building web pages. We can render tabular data using HTML's <table> element. The Pandas data analysis library provides functions like read_html() and to_html() so we can import and export data to DataFrames. In this article, we...
Reading and Writing XML Files in Python with Pandas
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...