Skip to content

Instantly share code, notes, and snippets.

@yaronv
Created July 31, 2018 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaronv/01a7e4856f7c3f1736f059b42fe30344 to your computer and use it in GitHub Desktop.
Save yaronv/01a7e4856f7c3f1736f059b42fe30344 to your computer and use it in GitHub Desktop.
train_data = pd.DataFrame(columns = ['id','text','response','name'])
prev_msg = ''
for index, row in df.iterrows():
if prev_msg != '':
tmp = pd.DataFrame({'text': [prev_msg], 'response': [row['message']], 'id': [row['id']], 'name': [row['name']]})
train_data = train_data.append(tmp[['id','text','response','name']], ignore_index=True)
prev_msg = row['message']
display(train_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment