pandas for loop grid subplots
plt.figure(figsize=(10,12))
for i in range(1, 7):
plt.subplot(3, 2, i)
plt.show()
#eg2
plt.figure(figsize=(9,6))
plt.subplot(3,2,1)
plt.plot(euro_to_dollar['Time'], euro_to_dollar['US_dollar'])
plt.title('Original values', weight='bold')
for i, rolling_mean in zip([2, 3, 4, 5, 6],
[7, 30, 50, 100, 365]):
plt.subplot(3,2,i)
plt.plot(euro_to_dollar['Time'],
euro_to_dollar['US_dollar'].rolling(rolling_mean).mean())
plt.title('Rolling Window:' + str(rolling_mean), weight='bold')
plt.tight_layout() # Auto-adjusts the padding between subplots
plt.show()