# Plot financial data: timestamp + value

I have approximately 250,000 rows of data that looks like:

2015-02-28 00:00:00, 252.29
2015-02-28 00:05:00, 252.62
2015-02-28 00:10:00, 252.33
2015-02-28 00:15:00, missing
2015-02-28 00:20:00, 252.99
...


That means that in the first column I have the date along with specific time. In the second column I have the price. Moreover, some values are missing (instead of price, there is, e.g., "infinity").

I want to plot this dataset (on x-axis: date, on y-axis: price) and if the data points are missing to discontinue the plot and continue in the place where price is not missing. There may be 1,000 of subsequent observations that have no price and that is the reason why I want to explicitly show on the graph that there is a gap.

I tried something like this:

data = Import["data.csv", "CSV"]

dateplot[data_, label_] :=
DateListPlot[data,
Frame -> True,
Joined -> True,
PlotRange -> All,
PlotStyle -> Blue,
ImageSize -> 800,
AspectRatio -> 0.4,
FrameLabel -> {"", "", Style[label, 14]}]

price = Table[Total[data[[i]]], {i, 1, Length[data]}];

dateplot[price, ""]


but it did not work properly. I would appreciate any suggestion. I am really desperate.

• Did you look at least some of the values in price to see what you were actually plotting? That is almost always a good idea, Try something like price // Short – m_goldberg Mar 15 '15 at 0:29
• Forget the Import for now, try it with a List containing a few values and come back with the results – Dr. belisarius Mar 15 '15 at 0:33
• Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Mar 15 '15 at 0:34
• "did not work properly." doesn't explain your difficulties very well, does it? – Dr. belisarius Mar 15 '15 at 13:46

dateplot[data_] := DateListPlot[data, Joined -> True, PlotRange -> All, Mesh -> All]