I am new to python pandas programming and trying to explore more on the cross tabulation. I have a requirement where I need to generate a cross table for multiple variables but with one constant variable. i.e. side as multiple variables and top one variable.
I have searched the web for my requirement however I could only find the cross tabulation among 2 or 3 variables only.
Coming to my requirement I have a dataset in data.csv
file which I am reading as a dataframe
df = pd.read_csv('C:\Users\Desktop\data.csv')
Now I want to cross tabulate the dataframe
(df) with one of the variable within this dataframe.
Like… pd.crosstab(df, df.age, margins=True)
example,
So could anyone help in solving this issue. Many thanks for the feedback.