Create new Dictionary with group and count based on existing Dictionary with tuple
I have the current Dictionary testdict:
Dictionary<int, Tuple<int, string, string>> testdict
Which is basically a Dictionary<autoID, Tuple<ignore, "shortcode", "product_name">>
Example:
testdict.Add(1, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(2, new Tuple<int, string, string>(2, "122", "Majenta Red"));
testdict.Add(3, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(4, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(5, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(6, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(7, new Tuple<int, string, string>(2, "766", "Purple"));
I need a new container that has this format:
autoid, "shortcode" group, "product_name" group, "count"
shortcode and product name always match, so they can be both grouped or group one and select any occurence of the second (first for example).
The int key can be ignored (it's just to create an order).
The int inside the tuple is also to be ignored.
An example of the new container I need would be:
Dictionary<int, Tuple<string, string, int>> newdict
newdict.Add(AutoID_Order, new Tuple<string, string, int>("shortcode", "product_name", count)); (structure)
newdict.Add(1, new Tuple<string, string, int>("555", "Light Blue", 3));
newdict.Add(2, new Tuple<string, string, int>("133", "Dark Yellow", 2));
newdict.Add(3, new Tuple<string, string, int>("122", "Majenta Red", 1));
newdict.Add(4, new Tuple<string, string, int>("766", "Purple", 1));
How can I accomplish this? Linq is acceptable.
c#
add a comment |
I have the current Dictionary testdict:
Dictionary<int, Tuple<int, string, string>> testdict
Which is basically a Dictionary<autoID, Tuple<ignore, "shortcode", "product_name">>
Example:
testdict.Add(1, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(2, new Tuple<int, string, string>(2, "122", "Majenta Red"));
testdict.Add(3, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(4, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(5, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(6, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(7, new Tuple<int, string, string>(2, "766", "Purple"));
I need a new container that has this format:
autoid, "shortcode" group, "product_name" group, "count"
shortcode and product name always match, so they can be both grouped or group one and select any occurence of the second (first for example).
The int key can be ignored (it's just to create an order).
The int inside the tuple is also to be ignored.
An example of the new container I need would be:
Dictionary<int, Tuple<string, string, int>> newdict
newdict.Add(AutoID_Order, new Tuple<string, string, int>("shortcode", "product_name", count)); (structure)
newdict.Add(1, new Tuple<string, string, int>("555", "Light Blue", 3));
newdict.Add(2, new Tuple<string, string, int>("133", "Dark Yellow", 2));
newdict.Add(3, new Tuple<string, string, int>("122", "Majenta Red", 1));
newdict.Add(4, new Tuple<string, string, int>("766", "Purple", 1));
How can I accomplish this? Linq is acceptable.
c#
1
I'm voting to close this question as off-topic because: We are not here to do your job for you. Show us your efforts (that you've tried at least something).
– Fabjan
Jan 20 at 14:27
Found two questions in SO about grouping and counting with dicts, but none similar to this one. Always resulted in error converting one format to the other. I really appreciate the help from the two users who answered, and perhaps this will help other users in the future. Sorry for not posting the results from my attempts.
– João Gomes
Jan 20 at 15:24
add a comment |
I have the current Dictionary testdict:
Dictionary<int, Tuple<int, string, string>> testdict
Which is basically a Dictionary<autoID, Tuple<ignore, "shortcode", "product_name">>
Example:
testdict.Add(1, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(2, new Tuple<int, string, string>(2, "122", "Majenta Red"));
testdict.Add(3, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(4, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(5, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(6, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(7, new Tuple<int, string, string>(2, "766", "Purple"));
I need a new container that has this format:
autoid, "shortcode" group, "product_name" group, "count"
shortcode and product name always match, so they can be both grouped or group one and select any occurence of the second (first for example).
The int key can be ignored (it's just to create an order).
The int inside the tuple is also to be ignored.
An example of the new container I need would be:
Dictionary<int, Tuple<string, string, int>> newdict
newdict.Add(AutoID_Order, new Tuple<string, string, int>("shortcode", "product_name", count)); (structure)
newdict.Add(1, new Tuple<string, string, int>("555", "Light Blue", 3));
newdict.Add(2, new Tuple<string, string, int>("133", "Dark Yellow", 2));
newdict.Add(3, new Tuple<string, string, int>("122", "Majenta Red", 1));
newdict.Add(4, new Tuple<string, string, int>("766", "Purple", 1));
How can I accomplish this? Linq is acceptable.
c#
I have the current Dictionary testdict:
Dictionary<int, Tuple<int, string, string>> testdict
Which is basically a Dictionary<autoID, Tuple<ignore, "shortcode", "product_name">>
Example:
testdict.Add(1, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(2, new Tuple<int, string, string>(2, "122", "Majenta Red"));
testdict.Add(3, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(4, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(5, new Tuple<int, string, string>(1, "555", "Light Blue"));
testdict.Add(6, new Tuple<int, string, string>(2, "133", "Dark Yellow"));
testdict.Add(7, new Tuple<int, string, string>(2, "766", "Purple"));
I need a new container that has this format:
autoid, "shortcode" group, "product_name" group, "count"
shortcode and product name always match, so they can be both grouped or group one and select any occurence of the second (first for example).
The int key can be ignored (it's just to create an order).
The int inside the tuple is also to be ignored.
An example of the new container I need would be:
Dictionary<int, Tuple<string, string, int>> newdict
newdict.Add(AutoID_Order, new Tuple<string, string, int>("shortcode", "product_name", count)); (structure)
newdict.Add(1, new Tuple<string, string, int>("555", "Light Blue", 3));
newdict.Add(2, new Tuple<string, string, int>("133", "Dark Yellow", 2));
newdict.Add(3, new Tuple<string, string, int>("122", "Majenta Red", 1));
newdict.Add(4, new Tuple<string, string, int>("766", "Purple", 1));
How can I accomplish this? Linq is acceptable.
c#
c#
edited Jan 20 at 14:12
Camilo Terevinto
18.4k63666
18.4k63666
asked Jan 20 at 14:09
João GomesJoão Gomes
12710
12710
1
I'm voting to close this question as off-topic because: We are not here to do your job for you. Show us your efforts (that you've tried at least something).
– Fabjan
Jan 20 at 14:27
Found two questions in SO about grouping and counting with dicts, but none similar to this one. Always resulted in error converting one format to the other. I really appreciate the help from the two users who answered, and perhaps this will help other users in the future. Sorry for not posting the results from my attempts.
– João Gomes
Jan 20 at 15:24
add a comment |
1
I'm voting to close this question as off-topic because: We are not here to do your job for you. Show us your efforts (that you've tried at least something).
– Fabjan
Jan 20 at 14:27
Found two questions in SO about grouping and counting with dicts, but none similar to this one. Always resulted in error converting one format to the other. I really appreciate the help from the two users who answered, and perhaps this will help other users in the future. Sorry for not posting the results from my attempts.
– João Gomes
Jan 20 at 15:24
1
1
I'm voting to close this question as off-topic because: We are not here to do your job for you. Show us your efforts (that you've tried at least something).
– Fabjan
Jan 20 at 14:27
I'm voting to close this question as off-topic because: We are not here to do your job for you. Show us your efforts (that you've tried at least something).
– Fabjan
Jan 20 at 14:27
Found two questions in SO about grouping and counting with dicts, but none similar to this one. Always resulted in error converting one format to the other. I really appreciate the help from the two users who answered, and perhaps this will help other users in the future. Sorry for not posting the results from my attempts.
– João Gomes
Jan 20 at 15:24
Found two questions in SO about grouping and counting with dicts, but none similar to this one. Always resulted in error converting one format to the other. I really appreciate the help from the two users who answered, and perhaps this will help other users in the future. Sorry for not posting the results from my attempts.
– João Gomes
Jan 20 at 15:24
add a comment |
2 Answers
2
active
oldest
votes
int count=0;
var z = testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.ToDictionary(x => ++count,
x => new Tuple<string, string, int>
(
x.Key.Item2, x.Key.Item3, x.Count()
));
Thanks. Works fine. Only missing the orderby count, but I can do that in the view.
– João Gomes
Jan 20 at 15:15
An .OrderByDescending(x => x.Count()) bellow the groupby also solves it.
– João Gomes
Jan 20 at 15:51
That will beIGrouped
items. How in the world is that equivalent toDictionary<int, Tuple<string, string, int>> newdict
. Wtever you do , at the end you have to use .ToDictionary` andcount
is just a variable here to index your results. There are probably better ways than usingcount
variable to index but i don't know rit now.
– Sumit raj
Jan 20 at 15:55
Sorry, but I don't understand your comment. The count I needed ordering is the x.Count() and not the count var. Don't needed it to be a proper ordered container, but since they are sent to the view in the same order they are inserted to the dict, it's enough. The way you wrote it works wonderfully.
– João Gomes
Jan 20 at 16:17
It’s ok. If this works for u , then all ok
– Sumit raj
Jan 20 at 16:19
add a comment |
Use GroupBy and then use ToDictionary
testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.Select((x, i) => new {
i,
ShortCode = x.Key.Item2,
ProductName = x.Key.Item3,
Count = x.Count(),
})
.ToDictionary(x => x.i, x => new Tuple<string, string, int>(x.ShortCode, x.ProductName, x.Count));
Instead of that First, why don't you GroupBy by the two properties? Then just use Key.Item1 and Key.Item2
– Camilo Terevinto
Jan 20 at 14:32
Can't quite figure this: error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.Dictionary>'
– João Gomes
Jan 20 at 15:16
@CamiloTerevinto, thanks... updated answer accordingly
– user2321864
Jan 21 at 8:47
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54277285%2fcreate-new-dictionary-with-group-and-count-based-on-existing-dictionary-with-tup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
int count=0;
var z = testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.ToDictionary(x => ++count,
x => new Tuple<string, string, int>
(
x.Key.Item2, x.Key.Item3, x.Count()
));
Thanks. Works fine. Only missing the orderby count, but I can do that in the view.
– João Gomes
Jan 20 at 15:15
An .OrderByDescending(x => x.Count()) bellow the groupby also solves it.
– João Gomes
Jan 20 at 15:51
That will beIGrouped
items. How in the world is that equivalent toDictionary<int, Tuple<string, string, int>> newdict
. Wtever you do , at the end you have to use .ToDictionary` andcount
is just a variable here to index your results. There are probably better ways than usingcount
variable to index but i don't know rit now.
– Sumit raj
Jan 20 at 15:55
Sorry, but I don't understand your comment. The count I needed ordering is the x.Count() and not the count var. Don't needed it to be a proper ordered container, but since they are sent to the view in the same order they are inserted to the dict, it's enough. The way you wrote it works wonderfully.
– João Gomes
Jan 20 at 16:17
It’s ok. If this works for u , then all ok
– Sumit raj
Jan 20 at 16:19
add a comment |
int count=0;
var z = testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.ToDictionary(x => ++count,
x => new Tuple<string, string, int>
(
x.Key.Item2, x.Key.Item3, x.Count()
));
Thanks. Works fine. Only missing the orderby count, but I can do that in the view.
– João Gomes
Jan 20 at 15:15
An .OrderByDescending(x => x.Count()) bellow the groupby also solves it.
– João Gomes
Jan 20 at 15:51
That will beIGrouped
items. How in the world is that equivalent toDictionary<int, Tuple<string, string, int>> newdict
. Wtever you do , at the end you have to use .ToDictionary` andcount
is just a variable here to index your results. There are probably better ways than usingcount
variable to index but i don't know rit now.
– Sumit raj
Jan 20 at 15:55
Sorry, but I don't understand your comment. The count I needed ordering is the x.Count() and not the count var. Don't needed it to be a proper ordered container, but since they are sent to the view in the same order they are inserted to the dict, it's enough. The way you wrote it works wonderfully.
– João Gomes
Jan 20 at 16:17
It’s ok. If this works for u , then all ok
– Sumit raj
Jan 20 at 16:19
add a comment |
int count=0;
var z = testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.ToDictionary(x => ++count,
x => new Tuple<string, string, int>
(
x.Key.Item2, x.Key.Item3, x.Count()
));
int count=0;
var z = testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.ToDictionary(x => ++count,
x => new Tuple<string, string, int>
(
x.Key.Item2, x.Key.Item3, x.Count()
));
edited Jan 20 at 14:36
answered Jan 20 at 14:26
Sumit rajSumit raj
8021413
8021413
Thanks. Works fine. Only missing the orderby count, but I can do that in the view.
– João Gomes
Jan 20 at 15:15
An .OrderByDescending(x => x.Count()) bellow the groupby also solves it.
– João Gomes
Jan 20 at 15:51
That will beIGrouped
items. How in the world is that equivalent toDictionary<int, Tuple<string, string, int>> newdict
. Wtever you do , at the end you have to use .ToDictionary` andcount
is just a variable here to index your results. There are probably better ways than usingcount
variable to index but i don't know rit now.
– Sumit raj
Jan 20 at 15:55
Sorry, but I don't understand your comment. The count I needed ordering is the x.Count() and not the count var. Don't needed it to be a proper ordered container, but since they are sent to the view in the same order they are inserted to the dict, it's enough. The way you wrote it works wonderfully.
– João Gomes
Jan 20 at 16:17
It’s ok. If this works for u , then all ok
– Sumit raj
Jan 20 at 16:19
add a comment |
Thanks. Works fine. Only missing the orderby count, but I can do that in the view.
– João Gomes
Jan 20 at 15:15
An .OrderByDescending(x => x.Count()) bellow the groupby also solves it.
– João Gomes
Jan 20 at 15:51
That will beIGrouped
items. How in the world is that equivalent toDictionary<int, Tuple<string, string, int>> newdict
. Wtever you do , at the end you have to use .ToDictionary` andcount
is just a variable here to index your results. There are probably better ways than usingcount
variable to index but i don't know rit now.
– Sumit raj
Jan 20 at 15:55
Sorry, but I don't understand your comment. The count I needed ordering is the x.Count() and not the count var. Don't needed it to be a proper ordered container, but since they are sent to the view in the same order they are inserted to the dict, it's enough. The way you wrote it works wonderfully.
– João Gomes
Jan 20 at 16:17
It’s ok. If this works for u , then all ok
– Sumit raj
Jan 20 at 16:19
Thanks. Works fine. Only missing the orderby count, but I can do that in the view.
– João Gomes
Jan 20 at 15:15
Thanks. Works fine. Only missing the orderby count, but I can do that in the view.
– João Gomes
Jan 20 at 15:15
An .OrderByDescending(x => x.Count()) bellow the groupby also solves it.
– João Gomes
Jan 20 at 15:51
An .OrderByDescending(x => x.Count()) bellow the groupby also solves it.
– João Gomes
Jan 20 at 15:51
That will be
IGrouped
items. How in the world is that equivalent to Dictionary<int, Tuple<string, string, int>> newdict
. Wtever you do , at the end you have to use .ToDictionary` and count
is just a variable here to index your results. There are probably better ways than using count
variable to index but i don't know rit now.– Sumit raj
Jan 20 at 15:55
That will be
IGrouped
items. How in the world is that equivalent to Dictionary<int, Tuple<string, string, int>> newdict
. Wtever you do , at the end you have to use .ToDictionary` and count
is just a variable here to index your results. There are probably better ways than using count
variable to index but i don't know rit now.– Sumit raj
Jan 20 at 15:55
Sorry, but I don't understand your comment. The count I needed ordering is the x.Count() and not the count var. Don't needed it to be a proper ordered container, but since they are sent to the view in the same order they are inserted to the dict, it's enough. The way you wrote it works wonderfully.
– João Gomes
Jan 20 at 16:17
Sorry, but I don't understand your comment. The count I needed ordering is the x.Count() and not the count var. Don't needed it to be a proper ordered container, but since they are sent to the view in the same order they are inserted to the dict, it's enough. The way you wrote it works wonderfully.
– João Gomes
Jan 20 at 16:17
It’s ok. If this works for u , then all ok
– Sumit raj
Jan 20 at 16:19
It’s ok. If this works for u , then all ok
– Sumit raj
Jan 20 at 16:19
add a comment |
Use GroupBy and then use ToDictionary
testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.Select((x, i) => new {
i,
ShortCode = x.Key.Item2,
ProductName = x.Key.Item3,
Count = x.Count(),
})
.ToDictionary(x => x.i, x => new Tuple<string, string, int>(x.ShortCode, x.ProductName, x.Count));
Instead of that First, why don't you GroupBy by the two properties? Then just use Key.Item1 and Key.Item2
– Camilo Terevinto
Jan 20 at 14:32
Can't quite figure this: error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.Dictionary>'
– João Gomes
Jan 20 at 15:16
@CamiloTerevinto, thanks... updated answer accordingly
– user2321864
Jan 21 at 8:47
add a comment |
Use GroupBy and then use ToDictionary
testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.Select((x, i) => new {
i,
ShortCode = x.Key.Item2,
ProductName = x.Key.Item3,
Count = x.Count(),
})
.ToDictionary(x => x.i, x => new Tuple<string, string, int>(x.ShortCode, x.ProductName, x.Count));
Instead of that First, why don't you GroupBy by the two properties? Then just use Key.Item1 and Key.Item2
– Camilo Terevinto
Jan 20 at 14:32
Can't quite figure this: error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.Dictionary>'
– João Gomes
Jan 20 at 15:16
@CamiloTerevinto, thanks... updated answer accordingly
– user2321864
Jan 21 at 8:47
add a comment |
Use GroupBy and then use ToDictionary
testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.Select((x, i) => new {
i,
ShortCode = x.Key.Item2,
ProductName = x.Key.Item3,
Count = x.Count(),
})
.ToDictionary(x => x.i, x => new Tuple<string, string, int>(x.ShortCode, x.ProductName, x.Count));
Use GroupBy and then use ToDictionary
testdict
.GroupBy(x => new { x.Value.Item2, x.Value.Item3 })
.Select((x, i) => new {
i,
ShortCode = x.Key.Item2,
ProductName = x.Key.Item3,
Count = x.Count(),
})
.ToDictionary(x => x.i, x => new Tuple<string, string, int>(x.ShortCode, x.ProductName, x.Count));
edited Jan 21 at 11:46
answered Jan 20 at 14:24
user2321864user2321864
1,25341627
1,25341627
Instead of that First, why don't you GroupBy by the two properties? Then just use Key.Item1 and Key.Item2
– Camilo Terevinto
Jan 20 at 14:32
Can't quite figure this: error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.Dictionary>'
– João Gomes
Jan 20 at 15:16
@CamiloTerevinto, thanks... updated answer accordingly
– user2321864
Jan 21 at 8:47
add a comment |
Instead of that First, why don't you GroupBy by the two properties? Then just use Key.Item1 and Key.Item2
– Camilo Terevinto
Jan 20 at 14:32
Can't quite figure this: error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.Dictionary>'
– João Gomes
Jan 20 at 15:16
@CamiloTerevinto, thanks... updated answer accordingly
– user2321864
Jan 21 at 8:47
Instead of that First, why don't you GroupBy by the two properties? Then just use Key.Item1 and Key.Item2
– Camilo Terevinto
Jan 20 at 14:32
Instead of that First, why don't you GroupBy by the two properties? Then just use Key.Item1 and Key.Item2
– Camilo Terevinto
Jan 20 at 14:32
Can't quite figure this: error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.Dictionary>'
– João Gomes
Jan 20 at 15:16
Can't quite figure this: error CS0029: Cannot implicitly convert type 'System.Collections.Generic.Dictionary>' to 'System.Collections.Generic.Dictionary>'
– João Gomes
Jan 20 at 15:16
@CamiloTerevinto, thanks... updated answer accordingly
– user2321864
Jan 21 at 8:47
@CamiloTerevinto, thanks... updated answer accordingly
– user2321864
Jan 21 at 8:47
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54277285%2fcreate-new-dictionary-with-group-and-count-based-on-existing-dictionary-with-tup%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I'm voting to close this question as off-topic because: We are not here to do your job for you. Show us your efforts (that you've tried at least something).
– Fabjan
Jan 20 at 14:27
Found two questions in SO about grouping and counting with dicts, but none similar to this one. Always resulted in error converting one format to the other. I really appreciate the help from the two users who answered, and perhaps this will help other users in the future. Sorry for not posting the results from my attempts.
– João Gomes
Jan 20 at 15:24