How to merge all the data to have a final dataset
A slightly hacky way to get there maybe but you can do this to get what you want from the second table;
df2['count'] = 1
pivot = df.pivot_table(df, index='userid', columns='productid', values = 'count').reset_index()
pivot = pivot.fillna(0)

You would then want to merge this to the first dataset like this;
finaldf = pd.merge(df1, pivot, left_on='userid', right_on='userid')

another great thing to use for generating the dummies for categorical variables is
pd.get_dummies()

The approach seems ok to me and making some more features would also not be a bad idea.