Python tutorials

Choosing a good file format for Pandas

Before you can process your data with Pandas, you need to load it (from disk or remote storage). There are plenty of data formats supported by Pandas, from CSV, to JSON, to Parquet, and many others as well. Which should you use? You don’t want loading the data to be slow, or use lots of memory: that’s pure overhead. Ideally you’d want a file format that’s fast, efficient, small, and broadly supported. You also want to make sure the loaded […]

Read more

Python’s .__call__() Method: Creating Callable Instances

In Python, a callable is any object that you can call using a pair of parentheses and, optionally, a series of arguments. Functions, classes, and methods are all common examples of callables in Python. Besides these, you can also create custom classes that produce callable instances. To do this, you can add the .__call__() special method to your class. Instances of a class with a .__call__() method behave like functions, providing a flexible and handy way to add functionality to […]

Read more

Using k-Nearest Neighbors (kNN) in Python

In this video course, you’ll get a thorough introduction to the k-Nearest Neighbors (kNN) algorithm in Python. The kNN algorithm is one of the most famous machine learning algorithms and an absolute must-have in your machine learning toolbox. Python is the go-to programming language for machine learning, so what better way to discover kNN than with Python’s famous packages NumPy and scikit-learn! You’ll explore the kNN algorithm both in theory and in practice. It’s important to learn about the mechanics […]

Read more

How to Launch an HTTP Server in One Line of Python Code

Traditionally, if you wanted to handle HTTP requests and serve static content from files, then you had to set up a full-fledged web server like Apache or NGINX, which could be a tedious process. Building a dynamic web application requires installing a web framework, such as Django, Flask, or FastAPI, which adds yet another complexity layer. Fortunately, you can take advantage of a basic HTTP server built into Python to avoid all this hassle. Python’s HTTP server can come in […]

Read more
1 45 46 47 48 49 191