I have a huge dataset, which looks similar to this:
data = Dataset[{
<|"a" -> 3,
"b" -> 5,
"c" -> Missing["NoInput"],
"d" -> 2600,
"e" -> 80,
"f" -> 300,
"g" -> {4114},
"h" -> {47.4718},
"i" -> {7.5088}|>,
<|"a" -> 4,
"b" -> 4,
"c" -> Missing["NoInput"],
"d" -> 1800,
"e" -> Missing["NoInput"],
"f" -> Missing["NoInput"],
"g" -> {3001, 3014, 3029},
"h" -> {46.9805, "XXX", 46.9339},
"i" -> {7.452, "XXX", 7.3891}|>}]
Is there a way to split the entries from “g”, “h” and “i” (they have always the same amount of entries) in new rows if they consist of more than one value. The values at the same position belong always together.
The newly added rows should take the entries from “a” – “f” and the spitted values from “g”, “h” and “i”.
My description is a little confusing. But the solution should look like this.
datafinal = Dataset[{
<|"a" -> 3,
"b" -> 5,
"c" -> Missing["NoInput"],
"d" -> 2600,
"e" -> 80,
"f" -> 300,
"g" -> 4114,
"h" -> 47.4718,
"i" -> 7.5088|>,
<|"a" -> 4,
"b" -> 4,
"c" -> Missing["NoInput"],
"d" -> 1800,
"e" -> Missing["NoInput"],
"f" -> Missing["NoInput"],
"g" -> 3001,
"h" -> 46.9805,
"i" -> 7.452,|>,
<|"a" -> 4,
"b" -> 4,
"c" -> Missing["NoInput"],
"d" -> 1800,
"e" -> Missing["NoInput"],
"f" -> Missing["NoInput"],
"g" -> 3029,
"h" -> 46.9339,
"i" -> 7.3891|>}]
“XXX” entries should left ignored.
I tried to create nested lists in “g”, “h” and “i” but never came to a solution.