Say you’ve written a really cool script in Python to do some interesting data analysis and now you want to demonstrate it to others. Chances are, sending over a
.py file and asking others to run it, or demonstrating yourself running it on the command line won’t have the same grasp as a nicely packaged and polished web application. By using the Python package
flask, we can create one of these interactive applications fairly quickly. …
I’ve recently heard a lot of buzz about proramming in Go and it piqued my curiousity. Proponents of Go laud it’s simplicity, concurrency, and performance — having basically been solely a Python programmer for the last few years, I wanted to try to get started with Go myself. Through learning some of the basics, I found it easiest to try find direct mappings between Python and the equivalent operation in Go. Here is just a small introduction to get started with Go yourself.
To install Go (or golang), you can either visit their website, or use Homebrew, where it is…
Deep learning, a subset of machine learning that deals with artificial neural networks, has shown to be extremely powerful at image classification. Despite the mathematical rigor of the inner workings of these algorithms, Python libraries such as
keras make these problems approachable to all of us. In this article, I will walk through the design of a simple image classifier using artificial neural networks to classify images of food into one of two classes: pizza or pasta. …
A couple of months ago, I wrote an extensive article on generating scientific publication plots with Python. Recently, I discovered this incredible new package called Pylustrator, which greatly simplifies the process of making multi-panel figures without the need to fiddle with axes sizes. The package also then generates Python code for you, so you can reproducibly recreate and share your figures with anyone else. I will do a basic demonstration of some of the thing you can do with
pylustrator in this article — hopefully it will be useful to you in plot making!
You can install
I come from an experimental science background where we deal with a ton of home-built experiment setups and data analysis scripts. Often, the result of this can be poorly documented and difficult-to-use code, especially after the original graduate student (who wrote it) has graduated and left. For this reason, when I developed some data analysis scripts during my grad school research, I decided I wanted to try and document/demonstrate it as well as I could so that any future users could use it intuitively. The result of my efforts is this landing page.
I’ve always been hesitant to learn how to use D3.js. It has always seemed much less intuitive than other libraries such as
matplotlib, which I have written extensively about. However, here I find myself writing a tutorial on making a plot in D3 — if you are developing a website or web application and want dynamic and interactive data visualizations, it may be useful to be familiar with the library. In this article, I have compiled the results of many trial-and-errors in that hope that it can both serve me well as a reference and help you avoid some simple…
Recently, I stumbled on this wonderful Python package called
nba_api, which can be found here, that serves as a very simple API client to retrieve stats from
www.nba.com. I have personally always wanted to create player shot charts like ones found online, but gathering the shot location data seemed like a daunting task. This is where
nba_api comes to the rescue! First, let’s install the package:
pip install nba_api
Now that we have installed
nba_api we can now import all the packages we will need to produce our own shot chart.
# Import packages from nba_api.stats.endpoints import shotchartdetail import json…
A candlestick chart is an effective way of displaying stock prices that gives more information that simply plotting the share price each day. The idea is that we have 4 pieces of information that we want to convey at each point:
It turns out that we can show this using a figure that looks fairly similar to a box and whisker plot. We use a box, or candle body, whose top and bottom edges reflect the opening and closing prices for the day —…
As we eagerly await the restart of the Premier League season on June 17th, we can look at the story of the season so far from this Kaggle dataset. As a Liverpool FC fan myself, I’d like to hope this season concludes with us as champions for the first time in the Premier League era (over the course of a historic, record-breaking season).
With a 25 point lead at the top of the table and needing only 6 points to secure a championship, Liverpool have dominated English football this past year. Let’s see how they have performed relative to their…
In experimental materials science, we are often given images such as the one below, called an X-ray diffraction pattern.