Zeppelin v0.10 not showing matplotlib graphs

I upgraded to Apache Zeppelin v0.10.x from v0.9.x and randomly my Python Matplotlib scripts stopped rendering images. Anything that called the plot method would just return the string response of the function. Like below:

%python
import matplotlib.pyplot as plt
plt.plot([1, 2, 3])

[<matplotlib.lines.Line2D at 0x7ff547624210>]
Code language: Python (python)

Continue reading “Zeppelin v0.10 not showing matplotlib graphs”

Plot your health with Samsung Health and Pandas

Artwork by Sami Lee.

For the last 5+ years, I’ve been tracking my various aspects of my personal health using Samsung Health. It helps track weight, calories, heart rate, stress, and exercise and stores all of it in the app.

However, the app only gives some basic high level charts and insights. Luckily, it enables you to export your personal data into CSV files that you can then import into your tool of choice and perform any kind of analytics. In this post, I’m going to show how to export it all, then load it into Zeppelin and some sample Pandas queries that’ll enable you to start building more complex queries yourself.

Continue reading “Plot your health with Samsung Health and Pandas”

Quick Alerts using Python & Pushover

It seems like all the bad things always happen whenever we’re far away from our computers. In my case, I’m trying to purchase a server from a company that seems to sell them as quick as I get them, so knowing right away when they come in is important. Ideally I’d like my whatever device I’m using to let me know right away if something has been made available.

To solve my dilemma, I’ve written a short python script using the chump library to periodically reload the webpage to determine whether or not the server I want is available for purchase. Chump is a pretty awesome python wrapper for the Pushover API that lets you quickly and easily send push notifications to any of your devices, or all of them at once.

Unfortunately, Pushover has a license cost of $4.99, but given what it comes with it seemed like a no-brainer for me to pick this up. Today it’s a simple script to alert me when a server is available for purchase, tomorrow it’ll be server monitoring alerts via push notifications.

Once you’ve created a Pushover account, it’ll give you a user key that is used to uniquely identify you and send push notifications to you. To get started, you’ll want to create an application so you can receive an application key. In this example, we’re going to use USERKEY and APPKEY to denote the string values of your user key and application key.

Once you’ve gotten these two pieces of information and installed chump (pip install chump), you can begin your own notification script like so:

from chump import Application
myApp = Application(‘APPKEY’)
#check to see if we’re authenticated successfully
if myApp.is_authenticated:
     print “Application Successfully Authenticated!”
else:
    print “Application Failed to Authenticate!”
    raise SystemExit
myUser = myApp.get_user(‘USERKEY’)
#check to see if the get_user returned successfully
if myUser.is_authenticated:
    print “User Successfully Authenticated!”
else:
    print “User Failed to Authenticate!”
    raise SystemExit
#We’re not going to check user devices because we want to send to all
myAlert = myUser.sendMessage(“Testing Chump & Pushover!”)
if myAlert.is_sent:
    print myAlert.id
    print str(myAlert.sent_at)
else:
    print “Failed to send message! Aborting!”
    raise SystemExit

And now we’ve sent a basic message via Pushover using chump. For more information on chump, check it out on readthedocs. I’m not going to get too far into the details of my automated system, but this should at least get you started sending push notifications to your devices.