You did not show the shapes of the data offending label for the truncated 10 year case.
Shapes have to match for -: to match. Shapes can be different because if you have 1 dimension(s), or if you have invisible characters. Take care, -- Raul On Tue, May 26, 2020 at 4:53 AM HH PackRat <[email protected]> wrote: > > On 5/25/20, Henry Rich <[email protected]> wrote: > > You used {: in the last line. Try it with {. . > > > > and on 5/25/20, 'robert therriault' via Programming > > <[email protected]> wrote: > > I noticed in the single line test that you used {: a and not {. a > > > > and on 5/25/20, bill lam <[email protected]> wrote: > > ... Maybe there are some typo such as {: instead of {. inside you code . > > Thanks for your eagle eyes in catching that typo! I had an older > remarked (NB.) line immediately above this line of code that had the > {:a which I visually copied instead of the correct {.a that I had used > everywhere else. > > Unfortunately, making this change did NOT change the results for the > full 10-year data. (It did work for the 10-day test case.) I have > no idea why this difference should exist. (The test case is the > column header row plus the first 10 days of the full 10-year file.) I > scanned the 10-year data, but nothing stood out as an anomaly. The > ONLY difference I noticed in the running of the J program is that the > initial boxing looks slightly different for the two sets of data. > (The data is read into file aa by the dsv routine in J.) I have no > idea why the two sets of data should look slightly different since the > data is the same, except for quantity. The difference is in the > display of the headers in the full data. (I tried my best to make > these look like the originals. It's very hard with a proportional > font.) > > Here is what a truncated output looks like for the 10-day test data: > > 3 {. aa > ┌─────┬─────┬─────┬─────┬─────┬──────┬───────┬──────┐ > │ "Date" │ "Price"│"Open" │ "High" │"Low" │ "Vol." │"Change %"│ > │ > ├─────┼─────┼─────┼─────┼─────┼──────┼───────┼──────┤ > │"May 22│ 2020" │"670.21"│"668.40"│"670.41"│"665.21"│"-" │"0.23%" > │ > ├─────┼─────┼─────┼─────┼──────┼─────┼───────┼──────┤ > │"May 21│ 2020" │"668.66"│"672.93"│"675.06"│"666.13"│"-" > │"-0.70%"│ > └─────┴─────┴─────┴─────┴──────┴─────┴───────┴──────┘ > 3 {. a > ┌─────┬───┬─────┬────┬────┬────┬──────┬────┐ > │Date │Price│Open │High │Low │Vol. │Change %│ │ > ├─────┼───┼─────┼────┼────┼────┼──────┼────┤ > │May 22 │ 2020│670.21│668.40│670.41│665.21│- │0.23% │ > ├─────┼───┼─────┼────┼────┼────┼──────┼────┤ > │May 21 │ 2020│668.66│672.93│675.06│666.13│- │-0.70%│ > └─────┴───┴─────┴────┴────┴────┴──────┴────┘ > DATE > 1 <-------- match is TRUE and column header row is deleted below > 3 {. a > ┌─────┬───┬────┬────┬─────┬────┬┬─────┐ > │May 22│ 2020│670.21│668.40│670.41│665.21│-│0.23% │ > ├─────┼───┼────┼────┼─────┼────┼┼─────┤ > │May 21│ 2020│668.66│672.93│675.06│666.13│-│-0.70%│ > ├─────┼───┼────┼────┼─────┼────┼┼─────┤ > │May 20│ 2020│673.36│670.68│675.42│670.26│-│1.73% │ > └─────┴───┴────┴────┴─────┴────┴┴─────┘ > > > And here is what a truncated output looks like for the full 10-year data: > > 3 {. aa > ┌──────┬────┬──────┬─────┬─────┬──────┬────────┬──────┐ > │"Date"│"Price"│"Open" │"High" │"Low" │"Vol." │"Change %"│ > │ > ├──────┼────┼──────┼─────┼─────┼──────┼────────┼──────┤ > │"May 22 │ 2020" │"670.21"│"668.40"│"670.41"│"665.21"│"-" > │"0.23%" │ > ├──────┼────┼──────┼─────┼─────┼──────┼────────┼──────┤ > │"May 21 │ 2020" │"668.66"│"672.93"│"675.06"│"666.13"│"-" > │"-0.70%"│ > └──────┴────┴──────┴─────┴─────┴──────┴────────┴──────┘ > 3 {. a > ┌─────┬───┬-─-─-─┬─────┬────┬────┬──────┬────┐ > │Date│Price│Open │High │Low │Vol. │Change %│ │ > ├─────┼───┼-─-─-─┼─────┼────┼────┼──────┼────┤ > │May 22 │ 2020│670.21│668.40│670.41│665.21│- │0.23% │ > ├─────┼───┼-─-──-┼─────┼────┼────┼──────┼────┤ > │May 21 │ 2020│668.66│672.93│675.06│666.13│- │-0.70%│ > └─────┴───┴─-─-─-┴─────┴────┴────┴──────┴────┘ > DATE > 0 <-------- match is FALSE and column header row is not deleted below > 3 {. a > ┌─────┬───┬-─-─-─┬─────┬────┬────┬──────┬────┐ > │Date│Price│Open │High │Low │Vol. │Change %│ │ > ├─────┼───┼-─-─-─┼─────┼────┼────┼──────┼────┤ > │May 22 │ 2020│670.21│668.40│670.41│665.21│- │0.23% │ > ├─────┼───┼-─-──-┼─────┼────┼────┼──────┼────┤ > │May 21 │ 2020│668.66│672.93│675.06│666.13│- │-0.70%│ > └─────┴───┴─-─-─-┴─────┴────┴────┴──────┴────┘ > > I'm curious why the headers are completely in sync with the data box > shapes when using the test data but out of sync with the box shapes > when using the full data (as well as having a match that is false > rather than true). > > Here is the very brief code that I've been using for testing: > > NB. ci2.ijs > require 'files stdlib' > require 'tables\dsv' > root=: '!user\......' NB. wherever you wish > > NB. syntax: ci2 'datafilename' > ci2=: 3 : 0 > aa=. ',' readdsv (jpath root,y) > smoutput 3 {. aa > a=. removedoublequotes each aa > smoutput 3 {. a > smoutput toupper (> 0 { ({. a)) > smoutput 'DATE' -: toupper (> 0 { ({. a)) > if. 'DATE' -: toupper (> 0 { ({. a)) do. a=. }. a end. > smoutput 3 {. a > ) > NB. ======================== > NB. adapted from source: "Special Matrices & Lists" in "Phrases" > NB. [original: removeblanks] > removedoublequotes=: -.@('"'&E.) # ] > NB. ======================== > > I would be happy to share the test file and full file via email with > anyone who is interested in figuring out this puzzle. The test file > is 699 B, and the full file is 159 KB. > > I'm eager to find out why the test file works but the full file > doesn't (even though the test file is the first 11 rows of the full > file). > > Harvey > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
