I have a dataframe with a lot of missing values which looks like this:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
date = pd.date_range(start='2003/01/01', end='2005/12/31')
df = pd.DataFrame({'date':date, })
Assign missing values to columns:
df = pd.DataFrame(np.nan, index=date, columns=['A', 'B'])
Add some actual values throughout to illustrate what my data actually looks like
df.loc['2003-01-10', 'B'] = 50
df.loc['2003-01-15', 'A'] = 70
df.loc['2003-06-10', 'B'] = 45
df.loc['2003-07-15', 'A'] = 55
df.loc['2004-01-01', 'B'] = 20
df.loc['2004-01-05', 'A'] = 30
df.loc['2004-05-01', 'B'] = 25
df.loc['2004-06-05', 'A'] = 35
df.loc['2005-01-01', 'B'] = 40
df.loc['2005-01-05', 'A'] = 35
Plot the data
df.plot(style = '-o')
This plot looks like this:
So you can see that I have specified that it be a line plot using the style = '-o' command, and it shows up correctly in the legend, but the dots are not joined by lines on the graph. When I plot it with no style specification I get a blank graph.
Any help would be greatly appreciated. Thank you.
