-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmerge_inferenced_datasets.py
22 lines (17 loc) · 1.04 KB
/
merge_inferenced_datasets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import pandas as pd
from pandas.core.frame import DataFrame
if __name__ == "__main__":
political = pd.read_pickle('data/inferences/tweets-with-political.pkl')
sentiment = pd.read_pickle('data/inferences/tweets-with-sentiment.pkl')
subj = pd.read_pickle('data/inferences/tweets-with-subj.pkl')
gender = pd.read_pickle('data/inferences/tweets-with-gender.pkl')
age = pd.read_pickle('data/inferences/tweets-with-age.pkl')
topics = pd.read_pickle('data/emerging_topics/period-all.pkl')
df_merge = political\
.merge(sentiment[['ID', 'raw_sentiment', 'total_sentiment']], how='inner', on='ID')\
.merge(subj[['ID', 'subjectivity']], how='inner', on='ID')\
.merge(gender[['ID', 'gender']], how='inner', on='ID')\
.merge(age[['ID', 'age']], how='inner', on='ID')\
.merge(topics[['ID', 'period', 'topic_distribution']], how='inner', on='ID')
print(df_merge.columns)
df_merge.to_pickle('data/inferences/dataset-inferenced.pkl')