Skip to content

Tag: dataframe

add a suffix when col names are similar

I am merging two dataframes and both of them have a col called “man”. After the join, one col is called “man_x” and the second is called “man_y”. Is it possible to append the table name or any other string instead of x, y when column names are the same? After this, If I add…

Python Data Frame summary

I have dataframe (df table below): Every user can post in any category. I have to calculate HOW MANY DISTINCT USERS has a post in category A and at the same time has posts in categories, B, C and D. Table like: User Category 1 A 1 B 33 B 33 C 33 D 54 A 54 B 87 A