[Solved] Pandas returning object type instead of values


I think you need aggregation by sum:

df3 = df2.groupby('Destination Address', as_index=False)['Aggregated Event Count'].sum()

Sample:

df2 = pd.DataFrame({'Destination Address':['a','a','a', 'b'],
                   'Aggregated Event Count':[1,2,3,4]})
print (df2)
   Aggregated Event Count Destination Address
0                       1                   a
1                       2                   a
2                       3                   a
3                       4                   b

df3 = df2.groupby('Destination Address', as_index=False)['Aggregated Event Count'].sum()
print (df3)
  Destination Address  Aggregated Event Count
0                   a                       6
1                   b                       4

Another solution:

df3 = df2.groupby('Destination Address')['Aggregated Event Count'].sum().reset_index()
print (df3)
  Destination Address  Aggregated Event Count
0                   a                       6
1                   b                       4

0

solved Pandas returning object type instead of values