import pandas as pd

posts = pd.read_csv('../input/post.csv', parse_dates=['timeStamp'])

comments = pd.read_csv('../input/comment.csv')

com_count = comments.groupby('pid').count()['cid']
data = posts.join(com_count, on='pid', rsuffix='c')[['msg', 'likes', 'shares', 'cid', 'gid']]
data.columns = ['msg', 'likes', 'shares', 'comments', 'gid']
data['msg_len'] = data.msg.apply(len)

data.gid = data.gid.map({117291968282998: 1, 25160801076: 2, 1443890352589739: 3})

data.fillna(0, inplace=True)
data.head()