I copied the title and concept for this question from here. I have
data = {{"ID", "Value"}, {1, 48}, {1, 45}, {1, 52}, {1, 43}, {1,
41}, {2, 50}, {2, 42}, {2, 51}, {2, 52}, {bb, 52}, {bb, 54}, {dd,
20}, {dd, 25}, {dd, 27}, {cc, 30}};
I want to create a new column called "Count" so that:
result = {{"ID", "Value", "Count"}, {1, 48, 1}, {1, 45, 2}, {1, 52,
3}, {1, 43, 4}, {1, 41, 5}, {2, 50, 1}, {2, 42, 2}, {2, 51,
3}, {2, 52, 4}, {bb, 52, 1}, {bb, 54, 2}, {dd, 20, 1}, {dd, 25,
2}, {dd, 27, 3}, {cc, 30, 1}};
I have a huge data with almost 2 billion observations. Therefore, efficient coding would save a lot of time and energy. As always, help is much appreciated. Thanks