I've been stuck in this problem for 1 week. I just want to make a graph (Log-Return vs time (in year, month, day)).
The code is:
datanikkei = Import["C:\\Users\\Rodrigo\\Desktop\\Nikkei.csv"] #Here I import the data from excel
close = datanikkei[[All, 5]]; #take the close price column
close = Delete[close, 1]; #Delete Title
ret = Differences[Log[close]*100.0] #calculate the returns
date = datanikkei[[All, 1]]; #Take the dates column
date = Delete[date, {{1}, {2}}]; #Delete title and first date of the list
date = Partition[date, 1]
list = Riffle[date, ret]
list = Partition[list, 2]
DateListPlot[list]
I get this:
{{{"1984,1,5"}, 0.201268}, {{"1984,1,6"},
0.140647}, {{"1984,1,7"}, -0.0702988}, {{"1984,1,8"},
0.620933}, {{"1984,1,9"}, 0.567476}, {{"1984,1,10"},
0.307281}, {{"1984,1,11"}, 0.464084}, {{"1984,1,12"}...
The different functions that I had used (like DateListPlot) to plot the returns vs the dates gave an error. But if I errase the quotation marks, it works. The error is:
DateListPlot::dtvals: "Unable to automatically determine horizontal coordinates for the given data and DataRange. !(*ButtonBox[\">>\", Appearance->{Automatic, None}, BaseStyle->\"Link\", ButtonData:>\"paclet:ref/DateListPlot\", ButtonNote->\"DateListPlot::dtvals\"])"
Please, help me Rodrigo
(* #Delete title and first date of the list *)
$\endgroup$ – Mike Honeychurch Jan 29 '15 at 3:38{"1984,1,5"}
. Normally dates are converted to date lists when imported from CSV or Excel so this problem shouldn't arise (??) $\endgroup$ – Mike Honeychurch Jan 29 '15 at 3:40