pivot table (excel vs python) - 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: pivot table (excel vs python) (/thread-36254.html) |
pivot table (excel vs python) - Bric - Feb-02-2022 Hello, I'm looking to do a pivot table of a csv file on Python, usually I do it on Excel but I'm looking to automate it. I started with this code school=df.groupby('domain+country').school.nunique() title=df.groupby('domain+country').title.nunique() tcddomcount=pandas.merge(school, title, on="domain+country") tcddomcount.columns = ['schooldomain+country','titledomain+country',] school2=df.groupby('email').school.nunique() title2=df.groupby('email').title.nunique() tcdmail=pandas.merge(school2, title2, on="email") tcdmail.columns = ['schoolmail','titlemail',]In this code I tried to translate from what I usually do in Excel firstly by taking online mails and schools and vacancies in value second by taking online domain+country and schools and internship in value except I don't get the same result with my code input what I need to have (with Excel) what i get with python I get the same result with table = pandas.pivot_table(df,index=['email'],values=['school','title'], aggfunc=pandas.Series.nunique)Does this mean that excel and python have two different ways of doing their pivot table? because otherwise python result is not correct RE: pivot table (excel vs python) - Bric - Feb-02-2022 Re I understood what the problem was Python considers that "i" != "I" Is there any way I can make it so that I can do the DCT without regard to upper/lower case? |