I have the following dataframe named ttm:
usersidid clienthostid eventSumTotal LoginDaysSum score 0 12 1 60
You simply need this instead:
ttm.groupby(['clienthostid'], as_index=False, sort=False)[['LoginDaysSum']].apply(lambda x: x.iloc[0] / x.iloc[1]).reset_index()
The double [[]] will turn the output into a pd.Dataframe instead of a pd.Series.
[[]]