So yeah, I’m back in this. Very simple script to turn an adjacency matrix to a D3js network json file. This is the file that we start with: node1 node2 node3 node1 0 8 1 node2 8 0 3 node3 1 3 0 As you can see, this is an undirected graph. This next bit […]
The .isin() function is a powerful tool that can help you search search for a number of values in a data frame. This is how it’s done. We start by creating a simple data frame The data frame should look something like this Now, we will use the .isin() function to select all the rows […]
Here is how to create a range of dates using the Pandas module. The range will start from April 2 2014 and will end October 1 2014. Well…here it is That’s pretty much it!
This one is just for me. No explanation. As is. This script will let you download all the posts submitted by any Reddit user. Just put the user name in line 9.
Working with json files can be freaking horrible, specially if you don’t know what data is in the file. Let me give you and example of how unreadable it can be. If you use Apple’s iTunes search API, and you search for user id 112018 you get this in return Which is crappy because you […]
I’m writing my thesis right now, so I haven’t had much time to post. I am now going through my literature review and I was looking for ways of storing and analysing all my citations so I can do a bit of bibliometrics. Long story short, after trying json and xml, I stumbled across yaml. […]
Just a very quick and dirty reminder of how to do this, starting with a data frame. Most of the info in this port can be found here. We can load the data frame (its a csv file) and check the data That should return The ones we want to plot are the 3 *_pec […]
This is a simple function that can help you time the code. All it does is use time() from the time module to saves the current time when the code begins, then saves the current time when it ends, and then calculates the difference. Then it uses the gmtime and strtime to format the calculated […]
This may not be the ideal way of doing, but it’s how I’m doing it for now. To build a local library with all the modules you write you should move the modules to the python, a process which is explained here. The main problem, however, is that if you want to edit them, then […]
This short script will help you create a range of dates that look like this 201203,201205,201306….