如何使用pandas.Dataframe
继续写入连续的行?我有以下连续调用的函数,并将给定的值写入.csv文件,但值被覆盖在同一行。有没有办法可以指定它写入连续的行?
def csv_writer(filename, OutputFolder):
f = open(OutputFolder + '\Output_' + filename +'_LOG.txt')
s = f.read()
m = re.search("GHz\s+\=(.*)dB",s)
if m:
Lossval = float(m.group(1))
print("Loss Value for filename " + filename + "is :", Lossval)
params['Lossval'] = Lossval
n = re.search("Impedance\s+\=(.*)ohms",s)
if n:
Zc = float(n.group(1))
print("Impedance Value for filename " + filename + "is :", Zc)
params['Zc'] = Zc
print("The Target Impedance is", TargetImpedance)
params['Target Impedance'] = TargetImpedance
value.append(params.copy())
df = pd.DataFrame(value)
df.to_csv('Values.csv')
Val = 1/(abs(Zc - TargetImpedance) + 100*Lossval)
return Val