I have a long text where I have inserted a delimiter ";" exactly where I would like to split the text into different columns. So far, whenever I try to split the text into 'ID' and 'ADText' I only get the first line. However there should be 1439 lines/rows in two columns.
My text looks like this: 1234; text in written from with multiple sentences going over multiple lines until at some point the next ID is written dwon 2345; then the new Ad-Text begins until the next ID 3456; and so on
I want to use the ; to split my text into two Columns, one with ID and one with the AD Text.
#read the text file into python:
jobads= pd.read_csv("jobads.txt", header=None)
print(jobadsads)
#create dataframe
df=pd.DataFrame(jobads, index=None, columns=None)
type(df)
print(df)
#name column to target it for split
df = df.rename(columns={0:"Job"})
print(df)
#split it into two columns. Problem: I only get the first row.
print(pd.DataFrame(dr.Job.str.split(';',1).tolist(),
columns=['ID','AD']))
Unfortunately that only works for the first entry and then it stops. The output looks like this:
ID AD
0 1234 text in written from with ...
Where am I going wrong? I would appreciate any advise =) Thank you!
