if I execute the following lines of codes in R as well as python for groupby command
, the order
of the resulting dataframes
are not matching when I convert them to dataframes
after that. How to maintain the order
to be same when I execute the R code in Python
.
in R
project_list <- project_data %>%
group_by(entity)%>%
distinct(Manager)
############
Python
project_list=project_data.groupby('entity').Manager.unique()
project_list=pd.DataFrame(project_list)
project_list=project_list.reset_index()
project_list['Manager']=project_list['Manager'].str.get(0)
#############
in R in Python
entity Manager entity Manager
ML_10 A ML_25 D
ML_08 B ML_10 A
ML_25 D ML_08 B
But the expected results should be similar to the one from R
What change need to be done in Python code to get the same results?