pandas/python : Get each distinct values of each column as columns and their counts as rows
pandas/python : Get each distinct values of each column as columns and their counts as rows Question: I have a data frame like this with below code, df=pd.DataFrame(columns=[‘col1’, ‘col2’, ‘col3’]) df.col1=[‘q1’, ‘q2’, ‘q2’, ‘q3’, ‘q4’, ‘q4’] df.col2=[‘b’, ‘a’, ‘a’, ‘c’, ‘b’, ‘b’] df.col3=[‘p’, ‘q’, ‘r’, ‘p’, ‘q’, ‘q’] df col1 col2 col3 0 q1 b …