2

I'd been having trouble using JoinAcross on two datasets. After going through the answers to my original question and fixing my code, I find I'm now having a problem that I think is being caused by my data. I'm adding a column to an Excel sheet, but not using it in my dataset. I'm reading in two Excel sheets, "Reported" and "Estimated". Below are screens shot of "Reported" followed by "Estimated":

Reported

Estimated

Next is my code and its output:

repFile = Import[NotebookDirectory[] <> "test.xlsx", {"Sheets", "Reported"}];
repHeader = repFile[[1]];
repData = repFile[[2 ;;]];

estFile = Import[NotebookDirectory[] <> "test.xlsx", {"Sheets", "Estimated"}];
estHeader = estFile[[1]];
estData = estFile[[2 ;;]];

repDS = Dataset@Map[AssociationThread[repHeader, #] &]@repData;
estDS = Dataset@Map[AssociationThread[estHeader, #] &]@estData;

rep1 = repDS[All, {"a", "z1"}];
est1 = estDS[All, {"a", "z2"}];

rep1
est1
rep1 // Normal
est1 // Normal
JoinAcross[rep1, est1, "a"]

Output1

Now I add one column to "Estimated" to get:

Estimated2

My output now looks like:

Output2

Since I'm not actually bringing in that additional column to the dataset I don't understand what's happening. Is this a bug or am I doing something wrong?

C. E.
  • 70,533
  • 6
  • 140
  • 264
Mitchell Kaplan
  • 3,696
  • 22
  • 34

0 Answers0