How to compare two dataframes and put the counted unique values in a first dataframe's column?
What you want can be achieved using themerge function in pandas. Here is the code:

df1 = pd.DataFrame({'FID_1':[1,2,3]})
df2 = pd.DataFrame({'NEAR_FID':[1,1,1,1,2,2,3,3]})

df_freq = df2.NEAR_FID.value_counts().reset_index()
df = pd.merge(df_freq, df1, how='inner', left_on=['index'], right_on=['FID_1'])
df
       index  NEAR_FID  FID_1
0      1         4      1
1      3         2      3
2      2         2      2


You can remove any of the column index or FID_1 to get your desired output.

For more on merge function look at the official documentation
 and for a very good explanation of its working look here.

EDIT 1:
Merge function only accepts Dataframes and not series. So, if your data is in series format, convert it to dataframe first.
You can check the type of your data by:

print(type(df2))


And that should output pandas.core.series.Series

Use this to change it to a dataframe:

df = df.to_frame().reset_index()