Skip to content

Instantly share code, notes, and snippets.

@dmd
Created May 10, 2021 15:34
Show Gist options
  • Save dmd/33002c0270ab5fca6d13fbfc35f2a4f2 to your computer and use it in GitHub Desktop.
Save dmd/33002c0270ab5fca6d13fbfc35f2a4f2 to your computer and use it in GitHub Desktop.
#!/cm/shared/anaconda3/bin/python3
# coding: utf-8
import pandas as pd
import matplotlib.pyplot as plt
from glob import glob
import os
os.chdir('/home/ddrucker/usage-reports')
files = sorted(glob('data.2021*'))[-5:]
timepoints = [pd.read_csv(filename ,names=['bytes','folder'], sep=' ', index_col=1) for filename in files]
c=pd.concat(timepoints, keys=range(len(timepoints)), axis=1).transpose() / 10e11
c.index=[x.replace('data.','') for x in files]
c = c.drop(c.iloc[[-1]].columns[c.isna().any()].tolist(), axis=1)
while len(c.columns) > 15:
c = c.drop(c.iloc[-1].idxmin(axis=1), axis=1)
fig = c.plot(figsize=(15,10), ylabel='Terabytes')
plt.savefig('/home/ddrucker/public_html/qacct/usage.png', facecolor=fig.get_facecolor(), edgecolor='none')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment