Categories
data science

Clustering and forces in D3JS

The objective is to use D3JS’ network visualisation to cluster groups of nodes based on the link value. The full code and output of this example can be found here. First, I started with heybignick’s awesome network which itself is an adaptation of Mike Bostock’s network – but with node labels. The bit that we […]

Categories
Uncategorized

Robots Now Taking Your Orders – Python

There was a post on r/technology about robots potentially taking over from humans if the minimum wage rises. After someone made a comment about robots not being able to spit in your food, u/angryPenguinator replied with a script written in BASIC that describes a robot putting crap on your burger. Now I will try it […]

Categories
Uncategorized

Synchronising two folders – Python

It’s friday…more code for sh*ts and giggles. Limitations and that…. This is a very simple and basic script that will synchronise two directories. It works as long as the files have the same name. It works by measuring the time the files were changed and replacing the older one with the newest one. Again…it will […]

Categories
Uncategorized

The **kwargs Function Argument – Python

**kwargs can be used for multiple arguments which don’t really have to be specified. All the information is then stored as a dictionary. So if we have a function like this and we run it like this we get this confirming it is a dictionary. We could also call each argument with a loop If […]

Categories
Uncategorized

Counting Vowels in a String – Python

From this project. The Challenge Enter a string and the program counts the number of vowels in the text. For added complexity have it report a sum of each vowel found. The Logic Make a dictionary with the vowels as keys. Then loop through each letter in the string. If it’s a vowel, append it […]

Categories
Uncategorized

Key words in directory – Python

This script will read all the text files in a directory and output a list of all the words and how many times they apear.

Categories
data science

Sorting Vectors – R

A very quick reminder to myself on how to take data from a data frame, place them into vectors, then sort them from highest to lowest. The Data Frame The data frame now looks like this Create Vector Get all the subs and create a vector for a bar plot. we should get something like […]

Categories
data science

Plot for Density and Inclusiveness – R

This function will color all the nodes that are isolated in red. It will also draw the graph using the circle layout. No time to explain. Sorry. The Function

Categories
Uncategorized

Having fun with D3js – d3js

Stand-alone html file. Here’s a working example

Categories
Uncategorized

Combinations and Factorials – Python

Mathematical Combinations The combination formula is this… with n being the number of items available to you and k the number of items you can pick at one time (where order does not matter). In other words, if n = 4 (a,b,c,d), and k = 2, it means that we have four items to choose […]