过滤后如何将多个子集范围附加到新数据帧?

How to append many range of subset to a new dataframe after some filtering?

我有一个 子集(类型 ),其中包含许多子数据帧(子集[0]、子集[1]、子集[2]......等等)。我想对每个子集进行一些过滤,过滤后我想将它附加到一个新的数据帧。 我的代码:

new_df = pd.DataFrame()
for i in range(20):
     a = subsets[i]
     a = a[((a[f'RUT1_Ang_meas_{i}'] >= -1.047198) & (a[f'RUT1_Ang_meas_{i}'] <= 1.047198))]
     .
     .
     #some filtering
     .
     . 
     new_df= pd.concat([a],axis=1)

new_df.info() ```

i am getting an empty final dataframe.

How can i modify the code ?

试试这个:

list1 = []  

# inside the loop:  
list1.append(a)
 
# after the loop  
new_df = pd.concat(list1, axis=1)