How to reorder columns and rows in a dataframe. We start with three vectors which we will put into a data frame called tDF Renaming Columns There is away of entering the names when building the data frame, like this… But let’s just prentend we forgot to do that, and instead we’ve ended up with […]
Tag: programming
The list and the problem… I have a little list, and I would like to get a frequency count. so that i end up with something like this… Constructing the dataframe Step one is to put the list into a dataframe using the pandas module. The dataframe looks something like this… Getting a frequency count […]
Again, this is more for my reference than anything else. Including the following lines on your Python CGI script will save you loads of time and stop you from hating yourself. You can even get the deluxe model by making it write a log file for you It is all explained right here.
This will allow you to switch between different MacPorts python installs. I have 2.7 and 3.3 on the same computer. The first thing you can do is get a list of all the MacPorts python installations on the terminal On my computer this returns …which means that 2.7 is active, so running python in the […]
Connections Between Networks – R
This graph shows how connected each network is within a system. Each node represents a network, and each edges represents a person overlapping them. The darker the edge color, the more people spanning across the two communities. This post explains the method in a bit more detail. This graph was made in R, with the […]
Because of the Advanced Packaging Tool in Ubunut, installing all the modules for Python is pretty easy. This bit will install Numerical Python, which is needed for Pandas We can now install Pandas, for data frames Finally, we can now install iGraph for network analysis That simple!!!
Links Between Networks – Python
I have 43 networks where some of the actors overlap, and what I would like to do is to visualise this overlap. The problem is that these networks combined will have more that 40,000 nodes, so it will be very messy to stick everything into one network graph. So the next best thing is to […]
Mathematical Combination – Python
The idea is to print all the different combinations from a series of numbers in a list (order not important). This script will be used to automate the comparison of 40+ networks on a list :D So, if we start with a series of 1 to 5, what we want to get is So here […]
You start with a pajek file, called something_pajek.net, then you run this code. You should end up with something like this.
Draw and Save Network to PDF – R
Assuming you start with a pajek file, you can use the following two functions to draw the graph and save it on to a PDF file. Then you call the function like this …and you get something like this
You must be logged in to post a comment.