5 added 114 characters in body
source | link

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: still running ...7326.01
  • Map data: 0.0268449
  • Map data[[All, 2]]: 0.0175813
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509

Creating the EventSeries object costs some extra time, but it is potentially advantageous for the subsequent processing.

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: still running ...
  • Map data: 0.0268449
  • Map data[[All, 2]]: 0.0175813
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: 7326.01
  • Map data: 0.0268449
  • Map data[[All, 2]]: 0.0175813
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509

Creating the EventSeries object costs some extra time, but it is potentially advantageous for the subsequent processing.

4 added 45 characters in body
source | link

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: still running ...
  • Map data: 0.0268449
  • Map data[[All, 2]]: 0.0175813
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: still running ...
  • Map: 0.0268449
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: still running ...
  • Map data: 0.0268449
  • Map data[[All, 2]]: 0.0175813
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509
3 added 233 characters in body
source | link

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: still running ...
  • Map: 0.0268449
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

Your data looks like an EventSeries to me. Therefore let's treat it like one.

es = EventSeries[data /. "x" -> Missing[], 
  MissingDataMethod -> {"Interpolation", InterpolationOrder -> 0}]

es["Path"]
{{978220800, 7.78}, {978307200, 5.}, {978393600, 5.}, {978480000, 5.}, {979516800, 5.}, 
 {979603200, 3.89}, {979689600, 3.89}, {979862400, 2.22}}

Or

es["DatePath"] // Normal
{{{1931, 1, 1, 0, 0, 0.}, 7.78}, {{1931, 1, 2, 0, 0, 0.}, 5.}, 
 {{1931, 1, 3, 0, 0, 0.}, 5.}, {{1931, 1, 4, 0, 0, 0.}, 5.}, 
 {{1931, 1, 16, 0, 0, 0.}, 5.}, {{1931, 1, 17, 0, 0, 0.}, 3.89}, 
 {{1931, 1, 18, 0, 0, 0.}, 3.89}, {{1931, 1, 20, 0, 0, 0.}, 2.22}}

AbsoluteTimings for a list with 15492 entries, 37 % containing "x":

  • ReplaceRepeated: still running ...
  • Map: 0.0268449
  • Scan: 0.0581277
  • FoldList: 0.123955
  • EventSeries: 0.727509
2 added 319 characters in body
source | link
1
source | link