Python Forum
Remove extra count columns created by pandas groupby - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Remove extra count columns created by pandas groupby (/thread-32317.html)



Remove extra count columns created by pandas groupby - spyf8 - Feb-02-2021

Is there anyway to remove the extra count columns created by pandas groupby?

I'm doing a groupby nunique on multiple columns so it does the grouping and also creates duplicate columns with counts (numbers)...
I don't want these columns as I am exporting to CSV . Can anyone suggest a solution?


RE: Remove extra count columns created by pandas groupby - Naheed - Feb-10-2021

(Feb-02-2021, 11:25 PM)spyf8 Wrote: Is there anyway to remove the extra count columns created by pandas groupby?

I'm doing a groupby nunique on multiple columns so it does the grouping and also creates duplicate columns with counts (numbers)...
I don't want these columns as I am exporting to CSV . Can anyone suggest a solution?

Hello,
Yes, you can remove the extra column created by pandas groupby.
In order to assist you properly, it would be better if you could
share some working code that we can experiment with