'How to fill a specific position missing value in pandas Dataframe

I have a pandas Dataframe with 15 x 15 dimensions.

I am trying to fill the missing values using if statement. I want to fill the mirrored position of filled values. For example, if z.values[0, 0] == 1 then I want to fill the z.values[15, 15] value equal to 0 and vise versa. I am using this code:

    if z.values[0, 0] == 1:
        z.values[15, 15].fillna() == 0
    else:
        z.values[15, 15].fillna() == 1

Note: This is just for z.values[0, 0] I also want all the indexing to have the above mentioned coding using a for loop or something else.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source