maybe you could use dictionary instead, something like:
out_list = []
for i in ds.longitude.values:
for j in ds.latitude.values:
point = arr.sel(longitude=i,latitude=j)
p_detrend = sm.tsa.tsatools.detrend(point, order=1,axis=0)
result = {
'longitude': i,
'latitude': j,
'detrend_arr': p_detrend
}
out_list.append(result)
then you may use pandas to convert into pd.DataFrame
for other manipulation;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…