In [1]:
import subprocess
subprocess.call(['python', 'ctripref_stats_gai.py',
'--days', '-21'])
print('Task compelte!')
Take lastest csv and draw
In [2]:
%matplotlib notebook
import pandas as pd
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
from matplotlib.ticker import FuncFormatter
import glob, os
newest = max(glob.iglob('output_hotel_ref_stats_*.csv'), key=os.path.getctime)
print(newest)
headers = ['date', '#_of_bookings', '#_of_hotel_ref', 'comment', 'coverage']
df = pd.read_csv(newest)
print(df)
ax = df.plot(x='date', y='coverage', style='o-')
plt.gcf().autofmt_xdate()
# ax.set_yticklabels(['{:3.2f}%'.format(x*100) for x in vals])
ax.yaxis.set_major_formatter(FuncFormatter(lambda y, _: '{:.0%}'.format(y)))
In [ ]: