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

Sorting Lists for Lorenz Curve – Python

EDIT: This does not really work. Needs lots and lots of fixes. Use R instead. This function will take a list of 100+ numbers, divide them into percentiles, and return a list that can be used to plot a Lorenz Curve. The Function Running the Function First, we make a list full of integers. This […]

Categories
data science

From nCol to Pajek 2/2 – Python & R

Continues from here. I just found that the Python script in the previous post breaks when it encounters non-alphanumerical characters. That means I had to run a small code through Vim to delete them on both the usrIDs.txt and output.txt files. Once that was done then I had to change the usrIDs.txt file to add […]

Categories
Uncategorized

Obsolete New Page Search – Python

Obsolete stuff that will tell you if there is a “Next” page by looking for the string “next” in the HTML. A pretty useless loop… Finally, just a simple “If it’s there then we cool”

Categories
Uncategorized

Multiples of 3 and 5 – Python

My very first Python script Problem 1 from the Project Euler website. The Problem If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 […]

Categories
Uncategorized

draw.quick.graph – R