sui generis, linux, python, devops, robotics, polyamory, data custodian

The Zen of Python

2015-12-13 code ubergarm

Just noticed The Zen of Python today and found it amusing. A quick “one liner” for the easter egg.

import this
''.join([this.d[ch] if ch in this.d.keys() else ch for ch in this.s])

But who knows, I’m not a BDFL nor even Dutch. ;)

Visualizing python dataframes in jupyter notebook with Altair

2015-12-12 data science ubergarm
Finally, an easy way to turn Pandas DataFrames into sorted bar charts using brewer color schemes! It took a little playing around and it isn’t quite perfect yet, but here is a quick example of how to turn a Series or DataFrame into a lovely sorted stacked bar chart. References altair palettable jupyter notebook Run Jupyter Container Running as root allows you to !pip install or !apt-get install dependencies. Continue reading