Python
Python Numpy totorial
Filed in: Python
A basic Numpy tutorial with examples including creating ndarray, basic stats and simple linear algebra. Read More…
Python Pandas Tutorial
Filed in: Python
This is a quick basic tutorial on Python Pandas. I am using a data set to create the data frame and I will show how to manipulate it to do some basic data Science. Read More…
Python Threading
Basic threading in python is discussed and then we will show how to use use a Pool with an example using a Monte Carlo calculation as a task. Read More…
Python Context Management Protocol
Filed in: Python | Context Management Protocol
This is a short tutorial on the Python Context Management Protocol and use it with a "with" statement
In order to understand the context management protocol we need to look at the paradigm it is trying to solve. What the idea behind context management is to manage the context or resource being used. It is easy to forget to close a file after you have opened it and this can cause a memory leak as you have resources hogging memory you don’t need. Read More…
In order to understand the context management protocol we need to look at the paradigm it is trying to solve. What the idea behind context management is to manage the context or resource being used. It is easy to forget to close a file after you have opened it and this can cause a memory leak as you have resources hogging memory you don’t need. Read More…
Python Decorator
This is a quick tutorial on the Decorator pattern in Python. You probably need some basic Python to follow along, but I will try to keep it simple.
The decorator pattern in programming, no matter the language, is all about adding functionality or behaviour to something else. It can be used in the data sense where I have a lot of data and I want to decorate the data with a new column. I could also have an Object and I want to add new functionality to that object without affecting the current behaviour of that object. Now would it not be great if we could wrap functionality around an existing object? Well that is exactly what the python decorator does.
Read More…
The decorator pattern in programming, no matter the language, is all about adding functionality or behaviour to something else. It can be used in the data sense where I have a lot of data and I want to decorate the data with a new column. I could also have an Object and I want to add new functionality to that object without affecting the current behaviour of that object. Now would it not be great if we could wrap functionality around an existing object? Well that is exactly what the python decorator does.
Read More…