'Correct display of data after aggregation

In continuation of my question

There is a table in a CSV file format:

A B
35480007 0695388
35480007 0695388
35407109 3324741
35407109 3324741
35250208 0695388
35250208 6104556
86730903 3360935
86730903 3360935

By applying the code for aggregation:

df.groupby("B")["A"].unique()

I get the result:

695388     [35480007, 35250208]
3324741              [35407109]
3360935              [86730903]
6104556              [35250208]

Could you tell me please, how can I apply some kind of filter so that only those values that have a value greater than two can be displayed: that is so:

695388     [35480007, 35250208]

and how to save the result to a file, for example in txt.

I apologize in advance if my question seemed incorrect. I am very weak in the pandas library.

thank you very much!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source