I am trying to read CSV file that updates loads in PSS/E: csv structure is as follows:
10004,10,10
10006,10,10
10007,10,10
10008,10,10
with open('1.csv', 'r') as file:
reader = csv.reader(file)
for row in reader:
loaddatalst = row.split(',')
loadbus = int(loaddatalst[0])
loadid = '1'
loadp = float(loaddatalst[1])
loadq = float(loaddatalst[2])
psspy.load_data_4(loadbus, loadid, [_i, _i, _i, _i, _i, _i], [loadp, loadq, 0, 0, 0, 0])
but I am getting this error: loaddatalst = row.split(',') AttributeError: 'list' object has no attribute 'split'
Any advice?
updated code after Zach suggestion:
with open('load01.csv', 'r') as file:
reader = csv.reader(file)
for row in reader:
loadbus = int(row[0])
loadid = '1' # or loaddatalst [x], x is position of load id in row
loadp = float(row[1])
loadq = float(row[2])
psspy.load_data_4(loadbus, loadid, [_i, _i, _i, _i, _i, _i], [loadp, loadq, 0, 0, 0, 0])