I have several dataframes with similar columns:
df1
name, age, state
df2
name, age, state
and so on.
How can I count frequency occurrences of age values from age column across all dataframes? Something like:
Age Count
42 23
38 20
.. ..
Thank you!
You can concat the dataframes, then use GroupBy.count()
to get the counts by age, as follows:
pd.concat([df1, df2], ignore_index=True).groupby('age')['age'].count().reset_index(name='Count')