reporting.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:spot-price-reporter 作者: EntilZha 项目源码 文件源码
def create_plot(json_data, output):
    all_data = pd.DataFrame(json_data)
    df = all_data[all_data['ProductDescription'] == 'Linux/UNIX']
    df = df.drop_duplicates(subset=['DateTime', 'AvailabilityZone', 'InstanceType'])
    x_min = df['DateTime'].min()
    x_max = df['DateTime'].max()
    border_pad = (x_max - x_min) * 5 / 100

    g = sns.FacetGrid(
        df,
        col='InstanceType',
        hue='AvailabilityZone',
        xlim=(x_min - border_pad, x_max + border_pad),
        legend_out=True,
        size=10,
        palette="Set1"
    )
    g.map(plt.scatter, 'DateTime', 'SpotPrice', s=4).add_legend()
    plt.subplots_adjust(top=.9)
    g.fig.suptitle('AWS Spot Prices between {start} and {end}'.format(start=x_min, end=x_max))
    g.savefig(output, format='png')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号