Feb-02-2022, 10:11 AM
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
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
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