Getting descriptive statistics with (analytic) weighting using describe() in python
问题 I was trying to translate code from Stata to Python The original code in Stata: by year, sort : summarize age [aweight = wt] Normally a simply describe() function will do dataframe.groupby("year")["age"].describe() But I could not find a way to translate the aweight option into the language of python i.e. to give descriptive statistics of a dataset under analytic/ variance weighting. codes to generate the dataset in python: dataframe = {'year': [2016,2016,2020, 2020], 'age': [41,65, 35,28],