This took me ages to figure out, and it was tough getting a simple straightforward answer… BTW – I’m assuming that you know all the Flask basics, so I won’t be covering that. If you don’t, I suggest you go through their amazing tutorial. This is what I want: I want my web app to […]
I was data scraping the other day and saving the output to a JSON file, but the text in one of the entries was coming out wrong. Instead of “Antal Dovcsák”, it was coming out as “Antal Dovcs\u00e1k” instead. For context, my code looked something like this: And the output was this… After some googling […]
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 […]