I am analyzing data from an experiment, and have to combine measurements from two devices (variables "data" and "behavioral").
I want to be able to walk through the recordings in the "data" data frame, and then, if a specific condition is met (if x == Stimulus/S 2), I want it to be replaced with the corresponding value in the "behavior" datarame.
This is my code so far:
import os
import csv
import pandas as pd
os.chdir('C:/Users/eeg1/Desktop/NSM-Pilot')
col_names2 = ['Stimulus Name', 'Stimulus Content', 'Trials', 'This Rep Number', 'trials.thisTrialN', 'trials.thisN', 'trials.thisIndex', 'Button Box Keys', 'Button Box RT', 'Date', 'Frame Rate', 'expName', 'Session', 'Participant' ]
behavioral = pd.read_csv('NSM-01-behavioral.csv', names=col_names2, skiprows=[0])
counter2 = 0
for y in behavioral['Stimulus Content']:
counter2 += 1
col_names = ['Event Number', 'Onset', 'Duration', 'Description']
data = pd.read_csv(r'NSM-01-01.csv', names=col_names, skiprows=[0])
counter = 0
for x in data['Description']:
if x == 'Stimulus/S 2':
x = behavioral['Stimulus Content'][counter]
counter += 1
The problem is that this part seems to have no effect:
x = behavioral['Stimulus Content'][counter]