Tag Info

New answers tagged

0

Another formulation: list = {{{"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}}; list /. {s_String} :> ImportString[s, "CSV"][[1]] {{{1984, 1, 5}, 0.201268}, {{1984, 1, ...


3

mydata = {{{"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}}; fixedData = ToExpression /@ ({StringSplit[#[[1]][[1]], ","], #[[2]]} & /@ mydata) DateListPlot[fixedData] The trick was ...


4

I claim it is impossible to remain consistent with your convention of adding hours to second elements. Either we keep track of hours everythwere or we are in trouble. So now I'm going to ignore that :) drlist = {{"2015-01-01", "2015-01-05"}, {"2015-01-07", "2015-01-08"}, {"2015-01-12", "2015-01-23"}}; r = {"2015-01-04", ...


2

I do not follow your logic for why {{"2015-01-05", "2015-01-06"}, {"2015-01-07", "2015-01-11"}} is split into two ranges since "2015-01-06" and "2015-01-07" are adjacent, however overlooking that here is a fairly clean approach. Helper functions: toList[x : {_String, _String}, os_: {12, "Hour"}] := MapAt[DatePlus[#, os] &, DateRange @@ DateList /@ ...


2

This first part finds the complementary dates. sdate = "2015-01-04"; edate = "2015-01-14"; r = {sdate, edate}; drlist = { {"2015-01-01", "2015-01-05"}, {"2015-01-07", "2015-01-07"}, {"2015-01-12", "2015-01-23"}}; If[$VersionNumber == 10, fromDate[datelist_List] := QuantityMagnitude@DateDifference[{1899, 12, 30}, datelist], ...


4

To me this looks like an ambiguity in the docs when "Month" is specified as a possible shift because everything else implies a fixed shifting increment. If you really want to shift your data by a calendar month then try this: monthShift[timeSeries_, months_] := Module[{ts = timeSeries}, ts[[2, 2, 1, 1]] = (DatePlus[#1, {months, "Month"}] &) /@ ...


0

I think you can use a simple pattern match i.e Cases[sampleDates, {{_, 1, 1}, _}, 2]



Top 50 recent answers are included