Tag Info

New answers tagged

0

As kindly posted above by Square1 the error indeed is related to the Suggestion Bar Bug and will not appear if the Suggestion Bar is disabled in the preferences. What I still find a slight nuisance is the overhead related to DateObject: Table[ DateRange[DateObject[{2014, 1, 1}], DateObject[{2014, 12, 31}]], {1000}]; // AbsoluteTiming (* {67.372854, Null} ...


5

Use AbsoluteTime :- DateObject[Min[Map[AbsoluteTime, DateRange[DateObject[{2000, 1, 1}], DateObject[{2014, 10, 1}], "Month"]]]]


1

f1 = FinancialData["PA:ACA", "Return", {{2007, 1, 1}, {2014, 10, 20}}]; f2 = FinancialData["PA:AIR", "Return", {{2007, 1, 1}, {2014, 10, 20}}]; f3 = Select[GatherBy[Join[f1, f2], First], Length@# == 2 &]; Or f3b = Pick[#, Length@# == 2 & /@ #] &@GatherBy[Join[f1, f2], First]; f3 == f3b (* True *) The first 5 rows of f1, f2 and f3: ...


0

In MMA10 this can be done with TimeSeriesWindow EDIT Here base version of TimeSeriesWindow for MMA9 SelectBetweenDates[financialData_,{startDate_,endDate_}]:=Select[financialData,AbsoluteTime[startDate]<=AbsoluteTime[#[[1]]]<=AbsoluteTime[endDate]&]; SelectBetweenDates[f1,{{2014,10,2},{2014,10,8}}] ...


0

At first I tried this hack: ClearAll; temp = "Sun Jun 01 22:00:21 +0000 2014"; td = If[StringFreeQ[temp, "-"], DateList[{temp, {"DayNameShort", " ", "MonthNameShort", " ", "Day", " ", "Hour24", ":", "Minute", ":", "Second", " +", "Millisecond", " ", "Year"}}], DateList[{temp, {"DayNameShort", " ", "MonthNameShort", " ", "Day", ...


2

Some options Your date date = "Sun Jun 01 22:00:21 +0000 2014"; Eliminate wrong entry rep = StringReplace[date, "+0000" -> ""] "Sun Jun 01 22:00:21 2014" Convert to List list = rep // DateList {2014, 6, 1, 22, 0, 21.} Find day day = DayName[list] Sunday Consolidate {day}~Join~list {Sunday, 2014, 6, 1, 22, 0, 21.} ...


1

Manually fixing the timezone. datecalc[t_] := Module[{}, t2 = StringSplit[t, " " | ":"]; tzsign = StringTake[t2[[7]], 1]; tzhrs = ToExpression[StringTake[t2[[7]], {2, 3}]]; tzmin = ToExpression[StringTake[t2[[7]], -2]]; {hour, min} = ToExpression[t2[[{4, 5}]]]; If[SameQ[tzsign, "+"], h2 = hour + tzhrs; m2 = min + tzmin, h2 = hour - ...


3

The problem is with "TimeZone", that its not defined, and with using "Month" instead of "MonthName". This works: DateList[{"Sun Jun 01 22:00:21 2014", {"DayName", "MonthName", "Day", "Hour", "Minute", "Second", "Year"}}] Are the strings in temp with fixed format? Then removing the characters will do DateList[{StringDrop[temp, {21, 26}], {"DayName", ...


2

DateListPlot can be used with datasets with different timestamps: data1 = {{{2014, 10, 1}, 10}, {{2014, 10, 15}, 12}, {{2014, 10, 30}, 15}, {{2014, 12, 30}, 10}}; data2 = {{{2014, 9, 5}, 15}, {{2014, 9, 20}, 8}, {{2014, 11, 10}, 5}, {{2014, 12, 15}, 8}}; DateListPlot[{data1, data2}, Joined -> True, PlotMarkers -> {Automatic, 14}, ImageSize -> 400] ...


1

I think CalendarConvert, which is new in version 10 might help: CalendarConvert[ DateObject[{20134, 10, 16, 14, 10, 4}, TimeZone -> 0], "Julian"]


8

One way would be to specify an explicit x-axis range on the plots, using AbsoluteTime to convert the desired date range into the coordinate values required by PlotRange: $data1 = FinancialData["AAPL", {{2003, 9}, {2003, 11}}]; $data2 = FinancialData["MSFT", {{2003, 10}, {2004, 1}}]; $start = {2003, 8, 6, 0, 1, 29}; $end = {2004, 1, 24, 23, 46, 58}; ...


1

Here's a method inspired by Rojo's that uses VectorAngle to select corner points, based on their angle with adjoining points along the boundary. This avoids the traveling salesman. Generalizing to any month: days = <|Sunday -> 1, Monday -> 2, Tuesday -> 3, Wednesday -> 4, Thursday -> 5, Friday -> 6, Saturday -> 7|>; . ...


2

Perhaps instead of building the rectangles you can build lines, and only keep the vertices that appear an odd number of times? Such as sort = #[[Last@FindShortestTour[#, DistanceFunction -> ManhattanDistance]]] & october2014[Values, {# - {1, 1}, #, # - {0, 1}, # - {1, 0}} &][ Apply[Join] /* Counts /* Select[OddQ] /* Keys /* sort /* Line /* ...


1

Some really great answers. Mine is not as flashy but it took me a few hours to get it so I'm throwing it up nevertheless. I focused on making one month with the hope that I could make a month function and find a way to merge months together for a longer calendar (haven't gotten that far, yet). I've also gone the route of creating an item function for ...


7

ClearAll[mpbmdcg,ljr]; mpbmdcg[k_]:= Composition[MeshPrimitives[#,k]&, BoundaryMesh, DiscretizeGraphics, Graphics]; ljr = Composition[Line, Join[#, {#[[1]]}]&, Replace[#,Line[{a_,b_}]:>a, {0, Infinity}]&]; poly = First@mpbmdcg[2]@(Rectangle/@(-1+Normal[october2014[Values]])); fastdesc= FullSimplify[ Reduce[ ...



Top 50 recent answers are included