repairs stupid
This commit is contained in:
parent
3d4f559d2d
commit
df5fd51a5f
35
repairmystupidity.py
Normal file
35
repairmystupidity.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Created on Mon Aug 14 20:47:22 2023
|
||||||
|
|
||||||
|
@author: michael
|
||||||
|
"""
|
||||||
|
import pandas as pd
|
||||||
|
|
||||||
|
wd = "/home/michael/Documents/PS/Data/collectTweets/"
|
||||||
|
|
||||||
|
# datafile input directory
|
||||||
|
di = "data/IN/"
|
||||||
|
|
||||||
|
# Tweet-datafile output directory
|
||||||
|
ud = "data/OUT/"
|
||||||
|
|
||||||
|
falsch = wd + ud + "SenatorsTweets-Training_WORKING-COPY-correct.csv"
|
||||||
|
richtig = wd + ud + "SenatorsTweets-Training.csv"
|
||||||
|
correct = wd + ud + "SenatorsTweets-Training_WORKING-COPY-correct2.csv"
|
||||||
|
|
||||||
|
# Name of new datafile generated
|
||||||
|
senCSVprep = "SenatorsTweets-Training_WORKING-COPY-prepared"
|
||||||
|
|
||||||
|
# don't change this one
|
||||||
|
falsch = pd.read_csv(falsch, dtype=(object), sep=";")
|
||||||
|
richtig = pd.read_csv(richtig, dtype=(object))
|
||||||
|
|
||||||
|
df = pd.merge(falsch,richtig[['tid','rawContent', 'date']],on='tid', how='left')
|
||||||
|
df.drop(columns=['rawContent_x', 'date_x'], inplace=True)
|
||||||
|
df.rename(columns={'tid_y':'tid', 'rawContent_y':'rawContent', 'date_y':'date'}, inplace=True)
|
||||||
|
df = df[['tid','date','topicCovid','fake','rawContent','Unnamed: 6']]
|
||||||
|
df.rename(columns={'Unnamed: 6':'comment'}, inplace=True)
|
||||||
|
|
||||||
|
df.to_csv(correct, encoding='utf-8', sep=";")
|
Loading…
x
Reference in New Issue
Block a user