从CSV表读取Charcter值/字符串

时间:2017-08-22 15:26:28

标签: python excel python-2.7 psse

我无法从CSV表格中读取字符值/字符串值。我正在尝试将excel中的数据传输到此函数psspy.two_winding_chang_4。 Psspy来自模拟软件PSSE。它不起作用。我收到一个错误。该数组中该函数的第3个元素是我尝试放置数据的位置。该变量名为digit我的Excel工作表也已发布。Excel Sheet

Traceback (most recent call last):
File "C:\Users\RoszkowskiM\Desktop\win4.py", line 141, in <module>
psspy.two_winding_chng_4(from_,to,'{}'.format(digit),[_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f],[])
File ".\psspy.py", line 25588, in two_winding_chng_4
Two_Winding_Chng_4Error: two_winding_chng_4 Error: ierr=2
TypeError: an integer is required
ValueError: invalid literal for int() with base 10: 'T1'
>>> 

-

 for row in data:
     data_location,empty, year_link, from_, to,digit,name2,tla_2,min_value,max_value = row[5:15]
     output = 'From Bus #: {}\tTo Bus #: {}\t Area Station: {}\t VMIN: {} pu\tVMAX: {} pu\t'
     if year_link == year and tla_2==location:
        from_=int(from_)
        to=int(to)
        min_value=float(min_value)
        max_value=float(max_value)

        print(output.format(from_, to,name2, min_value, max_value))
        _i=psspy.getdefaultint()
        _f=psspy.getdefaultreal()
        psspy.two_winding_chng_4(from_,to,'{}'.format(digit),[_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i,_i],[_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f,_f, max_value, min_value,_f,_f,_f],[])

else:
    exit

0 个答案:

没有答案