I have a dataframe df with a column var, and another dataframe df2 with columns var and var2. Both columns var in 2 dataframes are exactly the same.
In my example, df['var'].map(df2) and df.var.map(df2) yield the same result. I would like to ask if this is just a coincidence in my particular dataset, or it always holds.
Thank you so much!
Update: In my example, these below codes also produce the same result.
df.groupby('parent_id')['parent_id'].transform('count').tolist()
and
df.groupby('parent_id').parent_id.transform('count').tolist()
This gives me a feeling that df.groupby('parent_id')['parent_id'] and df.groupby('parent_id').parent_id produce the same result.