In [1]:
import pandas as pd
In [2]:
# Set up paths/ os
import os
import sys
this_path=os.getcwd()
os.chdir("../data")
sys.path.insert(0, this_path)
In [3]:
infile="AutismParentMagazine-posts.csv"
df = pd.read_csv(infile,index_col=0)
df.head(2)
Out[3]:
In [4]:
df['text']=df['text'].map(lambda x: x.replace("Continue Reading",""))
In [5]:
df.loc[0,'text']
Out[5]:
In [6]:
# Extract only first lines
df.loc[0,'text'][:300]
Out[6]:
In [7]:
outfile="AutismParentMagazine-posts-clean.csv"
df.to_csv(outfile)