this is my first question at stackoverflow.
I have two dataframes of different sizes df1
(266808 rows) and df2
(201 rows).
df1
and
I want to append the count of each value/number in df1['WS_140m']
to df2['count']
if number falls in a class interval given in df2['Class_interval']
.
I have tried
1)
df2['count']=pd.cut(x=df1['WS_140m'], bins=df2['Class_interval'])
2)
df2['count'] = df1['WS_140m'].groupby(df1['Class_interval'])
3)
for anum in df1['WS_140m']:
if anum in df2['Class_interval']:
df2['count'] = df2['count'] + 1
Please guide, if someone knows.