I have two dataframes whereby the data in df is rewritten to dh in a different row (relationship between x and p is arbitrary). Each row in both frames has the same floating data type arranged horizontally as variables A B C D E F. I did this originally with:
dh.iloc[p,A] = df.iloc[x,A]
dh.iloc[p,B] = df.iloc[x,B]
dh.iloc[p,C] = df.iloc[x,C]
dh.iloc[p,D] = df.iloc[x,D]
dh.iloc[p,E] = df.iloc[x,E]
dh.iloc[p,F] = df.iloc[x,F]
It occurs to me that this is 6 discrete accesses to 6 discrete locations, and might be faster if I could write into all 6 at the same time. Is there any way to do this in a single statement that would execute faster?
import pandas as pd
import DataFrame as df
x=0
p=0
GDZ=0
while x < 1000:
if GDZ == 0:
ZroTst = df.iloc[x, Zerstng]
if ZroTst == 'ZZ':
GDZ = 1
x +=1
else:
x +=1
else:
ZroTst = df.iloc[x,Zerstng]
if ZroTst == 'BB':
GDZ = 0
x +=1
else:
p +=1
dh.iloc[p,A] = df.iloc[x,A]
dh.iloc[p,B] = df.iloc[x,B]
dh.iloc[p,C] = df.iloc[x,C]
dh.iloc[p,D] = df.iloc[x,D]
dh.iloc[p,E] = df.iloc[x,E]
dh.iloc[p,F] = df.iloc[x,F]
x +=1
x +=1