Sign in

South Africa Crime Data Visualization


SAPS (South African Police Service) has provided crime data via Kaggle which contains the history of crime statistics from 2004 to 2015 per province and station in South Africa. The dataset contains a set of shapefiles and CSV files.


Let’s see if we can generate an insightful analysis and report using this data by leveraging Python and Geemap for this project.


We will analyze the data fully using Python. To do so, we begin with importing necessary packages.

If you are interested in watching the video explanation, then the below is for you.

import Packages

We are…

Some interesting services that an open route provides


I have been working with geospatial data for quite a while. I always wanted to create something similar to google maps (at least a few services that it provides like geocoding, route-directions, etc). Google maps’ do provide an API for various services. But the API is not free. If you want to leverage the API for your applications, then you may want to provide credit card details and other things. Earlier, the Google API was free to use, but now the plan is changed. …

What the logistic regression algorithm is and how it is used in regression tasks.


Logistic regression is a statistical model which is extensively used in binary classification tasks. The name logistic because it uses a logistic function to do the classification. The logistic function is also known as cross-entropy. Besides this, we use a special function known as the sigmoid function to prevent the impact of outliers in the whole modeling.

Mathematical Model

Given the data points, we need to classify them into two classes (binary classification). We shall find a separating hyperplane to divide the classes.

What the linear regression algorithm is and how it is used in regression tasks.


Regression analysis is a process of predicting a response variable given an explanatory variable. The response variable is also called a dependent variable and an explanatory variable is known as an independent variable. Given a problem statement, when there are multiple explanatory variables and one response variable, then the process is known as Multiple Linear Regression. On contrary, if a problem statement contains only one explanatory variable and one response variable, it is known as Simple Linear Regression.

Note — For implementing regression analysis, there needs…

What the KNN algorithm is and how it is used in classification tasks.


KNN algorithm is a supervised classification algorithm that is mainly used to predict which category a query point belongs to, given a bunch of data values with respect to its corresponding categories (class labels). Talking from the perspective of the classification tasks, KNN is very much similar to Naive Bayes but slightly different in terms of technicality and implementation. In Naive Bayes, we compute the likelihood by probabilistic methods, whereas in KNN, we compute distance measurements along with other extensions added.

One great advantage of KNN is…

What the Naive Bayes algorithm is and how it is used in classification tasks


Classification is a task of grouping things together on the basis of the similarity they share with each other. It helps organize things and thus makes the study more easy and systematic. In statistics, classification refers to the problem of identifying to which set of categories an observation or data value belongs to.

Examples -

  • Identifying whether an email is a spam or not spam.
  • On certain parameters of health, identifying or classifying whether a patient gets a heart attack or not.

For humans, it can be very easy to do the classification task assuming that he/she has proper domain-specific…

In this article, we will see the complete analysis of “Crimes Against Women” that took place in India from 2001 to 2014.


The main agenda of this article to analyze crime data by following all the steps required for data analysis. The steps include Data Preparation, Data Cleaning, Data Wrangling, Feature Selection, Data Visualization & Comparison.

The data is about the crimes committed against women in India. The data is being recorded from 2001 to 2014. It includes crimes like -

  • Rape
  • Kidnapping and Abduction
  • Dowry Deaths
  • Assault on Women with intent to outrage her modesty
  • Insult to the modesty…

In this article, we will step by step procedure to convert a regular matrix into a sparse matrix easily using Python.


Matrix is a type of data structure similar to an array where values are stored in rows and columns. Here, the values are of a unique type. When dealing with matrices (linear algebra) in Machine Learning and NLP, we often hear about two types of matrices as -

  • Dense Matrix — The matrix where most of the elements are non-zero. In this matrix, there are very few zero elements.
  • Sparse Matrix — In contrast, the matrix where most of…

In this article, we will learn different ways of multiplying matrices from an easy-to-read function to an optimized code.


If you had read my previous articles on matrix operations, by now you would have already know what a matrix is. Yes, a matrix is a 2D representation of an array with M rows and N columns. The shape of the matrix is generally referred to as dimension. Thus the shape of any typical matrix is represented or assumed to have (M x N) dimensions.

  • Row Matrix — Collection of identical elements or objects stored in 1 row and N columns.

with Code Snippets

In this article, I will share my experience (the errors and issues) while deploying the app which I developed.

For a while till now, I have been working on my basic image processing app developed in Python using the frameworks and libraries like -

  • Dash
  • Plotly
  • Plotly express
  • NumPy &
  • OpenCV
  • and some other dependencies

Let me explain how the journey of developing this app began.


First, I didn’t have any idea or plan to develop an app (that too for image processing). It is when one of my colleagues asked in our common group -

How do I re-mirror…


Python Developer | Python Mentor | Aspiring Geo Data Scientist | Support me:

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store