[Solved] I want to group Columns in pandas [closed]


Try this:

uniq_accounts = differenc['AccountID'].unique()
grped = differenc.groupby('AccountID')

## You can get the grouped data for a certain AccountId like this and store in a dictionary:

d = {}
for account in uniq_accounts:
    d[account] = grped.get_group(account)

##Now, dictionary has all accounts data in separate dataframes. You can access like this:

for key in d.keys():
    print(d[key])

## If you want to fetch data for a particular AccountID(lets say 316001718201), you can do:

print(d['316001718201'])

Let me know if it helps.

0

solved I want to group Columns in pandas [closed]