Hey I have DataFrame of numbers and I would like to create new dataFrame with true and false values by comparing the value of a cell in i row and j column  with a value of a cell in '1' row and 'j' column. I do that using double for loop but maybe there is more elegant solution.
            Asked
            
        
        
            Active
            
        
            Viewed 85 times
        
    0
            
            
         
    
    
        Placer
        
- 37
- 5
1 Answers
0
            Please review How to make good reproducible pandas examples before asking Pandas questions. Specifically you should provide a sample dataframe and a specific question you
As for your question, suppose we have a df:
df = pd._testing.makeDataFrame().iloc[:5]
that looks like this
             A          B           C           D
G6p2JNeEet  -0.315007   0.519647    0.117529    0.532278
pQoojOAqyg  -1.611355   1.405858    -1.324369   0.573910
uFh3timL3x  -0.372210   1.394280    0.863960    0.162457
KfYIQCuya7  2.247528    -0.531482   -0.715472   2.523932
j5CM2VKjTH  1.784814    -0.459058   0.875925    1.955540
then you can compare for 'greater' condition, as an example, simply by
df1 = (df > df.iloc[0,:])
to obtain a boolean df:
            A       B       C       D
G6p2JNeEet  False   False   False   False
pQoojOAqyg  False   True    False   True
uFh3timL3x  False   True    True    False
KfYIQCuya7  True    False   False   True
j5CM2VKjTH  True    False   True    True
 
    
    
        piterbarg
        
- 8,089
- 2
- 6
- 22