Python tutorials

K-Nearest Neighbors Algorithm in Python and Scikit-Learn

The K-nearest neighbors (KNN) algorithm is a type of supervised machine learning algorithms. KNN is extremely easy to implement in its most basic form, and yet performs quite complex classification tasks. It is a lazy learning algorithm since it doesn’t have a specialized training phase. Rather, it uses all of the data for training while classifying a new data point or instance. KNN is a non-parametric learning algorithm, which means that it doesn’t assume anything about the underlying data. This […]

Read more

Python Metaclasses and Metaprogramming

Imagine if you could have computer programs that wrote your code for you. It is possible, but the machines will not write all your code for you! This technique, called metaprogramming, is popular with code framework developers. This is how you get code generation and smart features in many popular frameworks and libraries like Ruby On Rails or TensorFlow. Functional programming languages like Elixir, Clojure, and Ruby are noted for their metaprogramming capabilities. In this guide, we show you how […]

Read more

Reading Files with Python

To work with stored data, file handling belongs to the core knowledge of every professional Python programmer. Right from its earliest release, both reading and writing data to files are built-in Python features. In comparison to other programming languages like C or Java it is pretty simple and only requires a few lines of code. Furthermore, no extra module has to be loaded to do that properly. Basics of Files in Python The common methods to operate with files are […]

Read more

Decision Trees in Python with Scikit-Learn

Introduction A decision tree is one of most frequently and widely used supervised machine learning algorithms that can perform both regression and classification tasks. The intuition behind the decision tree algorithm is simple, yet also very powerful. For each attribute in the dataset, the decision tree algorithm forms a node, where the most important attribute is placed at the root node. For evaluation we start at the root node and work our way down the tree by following the corresponding […]

Read more

Writing Files using Python

As pointed out in a previous article that deals with reading data from files, file handling belongs to the essential knowledge of every professional Python programmer. This feature is a core part of the Python language, and no extra module needs to be loaded to do it properly. Basics of Writing Files in Python The common methods to operate with files are open() to open a file, seek() to set the file’s current position at the given offset, and close() […]

Read more

Single Page Apps with Vue.js and Flask: RESTful API with Flask

RESTful API with Flask Welcome to the fourth post on using Vue.js and Flask for full-stack web development. The focus of this post will be on building a backend REST API using the Python based Flask web framework. The code for this post is in a repo on my GitHub account under the branch FourthPost. Series Content Seup and Getting to Know VueJS Navigating Vue Router State Management with Vuex RESTful API with Flask (you are here) AJAX Integration with […]

Read more

Creating and Deleting Directories with Python

This article continues with our series on interacting with the file system in Python. The previous articles dealt with reading and writing files. Interestingly, the file system is much more than a way to store/retrieve data to disk. There are also various other types of entries such as files, directories, sockets (for inter-process communication), named pipes, both soft and hard links, as well as special files (block devices). Reading and writing from and to them is done in a similar […]

Read more

Single Page Apps with Vue.js and Flask: AJAX Integration

AJAX Integration with REST API Thanks for joining me for the fifth post on using Vue.js and Flask for full-stack web development. This post will be fairly short, but highly valuable as I will be demonstrating how to connect the front-end and back-end applications using Asynchronous Javascript and XML (aka, AJAX). The code for this post can be found on my GitHub account under the branch FifthPost. Series Content Seup and Getting to Know VueJS Navigating Vue Router State Management […]

Read more

Reading and Writing Lists to a File in Python

As serialized data structures, Python programmers intensively use arrays, lists, and dictionaries. Storing these data structures persistently requires either a file or a database to work with. This article describes how to write a list to file, and how to read that list back into memory. To write data in a file, and to read data from a file, the Python programming language offers the standard methods write() and read() for dealing with a single line, as well as writelines() […]

Read more

Single Page Apps with Vue.js and Flask: JWT Authentication

JWT Authentication Welcome to the sixth installment to this multi-part tutorial series on full-stack web development using Vue.js and Flask. In this post I will be demonstrating a way to use JSON Web Token (JWT) authentication. The code for this post can be found on my GitHub account under the branch SixthPost. Series Content Seup and Getting to Know VueJS Navigating Vue Router State Management with Vuex RESTful API with Flask AJAX Integration with REST API JWT Authentication (you are […]

Read more
1 175 176 177 178 179 182