Python Forum

Full Version: Python Matplotlib help!!!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import pandas as pd
from pandas import Series
from matplotlib import pyplot as plt


data = pd.read_csv ('data.csv')

plt.plot(data.Date, data.Leverage)
plt.show()
Data
Date Leverage
Dec-52 2.01%
Mar-53 1.64%
Jun-53 0.51%
Sep-53 0.29%
Dec-53 0.72%
Mar-54 1.99%
Jun-54 4.59%
Sep-54 5.50%
Dec-54 5.90%
.......
Sep-15 -1.24%
Dec-15 -1.29%
Mar-16 -0.25%
Jun-16 0.90%
Sep-16 1.76%
Dec-16 1.42%
Mar-17 0.75%
Jun-17 -0.04%
Sep-17 -0.52%
Dec-17 -0.11%
Mar-18 -0.48%
Jun-18 -1.11%
Sep-18 -1.72%


When I plot this data using matplotlib, the data look very different (image attached). The Y axis is not clear and the data does not supposed to look like the one shown in the picture. Can someone point out where I am going wrong?

Thanks
It's probably reading in all of your data as strings. You will need to convert that data to dates and percentages for it to plot correctly.