另外,重采样('D')和重采样('C')之间的区别是什么。这是我正在编写的代码。我想看看我是否能放大程序给我的图表。提前谢谢
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
precip = pd.read_csv('1948colorado2019daily.csv',
parse_dates=['DATE'], na_values=['999.99'])
# resample
precip_d = precip.set_index('DATE')
daily_sum_precip = precip_d.resample('D').sum().apply(np.round, decimals=1)
# remove days with no rain
daily_sum_precip = daily_sum_precip[(daily_sum_precip.PRCP != 0.00)]
# note when plottinglots of bars, snap = False will turn off the pixel snapping or set the width to
be wider.
fig, ax = plt.subplots(figsize=(16, 8))
ax.plot(daily_sum_precip.index,
daily_sum_precip['PRCP'].values,
'o',
color='purple')
ax.set_title("The figure below shows the total precipitation each month from 1948 to 2013 ")
pd.plotting.register_matplotlib_converters()
plt.show()
目前没有回答
相关问题 更多 >
编程相关推荐