'How to show my "dates" column in x-axis? My dates column was by default an index column, so I changed it by resetting index

I have done resetting of my "dates" values from index to column 1. But this graph doesn't show "dates" on the x-axis

Here is the code:

#Plotting the data

trainy = closedf[:training_data_set]
valid = closedf[training_data_set:]
valid["Predictions"] = predictions

#visuaization

plt.figure(figsize = (16,8))
plt.title("Model")
plt.xlabel("Date", fontsize = 18)
plt.ylabel("Closed Price($)",fontsize = 18)


plt.plot(trainy["close"], color = "seagreen")
plt.plot(valid["close"], color = "maroon")
plt.plot(valid["Predictions"],color = "salmon")

plt.legend(["Train", "Validation", "Predictions"], loc = "upper right")
plt.grid(b = None)
plt.show()

for the output (click here)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source