I have some time series data in a pandas dataframe. Many entries have a NaN value, and I'd like to make a matching column storing whether that entry has a NaN value or not, and then replace the NaN values with 0. While replacing the NaN values is easy enough, I can't figure out how to do the first part. If it matters, I already used a pivot operation so column names are tuples. Some of the values in the dataframe are ints and some are floats.
Example input:
df = pd.DataFrame(np.array([[5, 7,  np.nan], [np.nan, 8, 9.8], [7, np.nan, 12]]), columns=[('Label', 'A'), ('Label', 'B'), ('Label', 'C')])
    
                 Label
             A   B   C
2021-03-01   5   7 NaN
2021-03-02 NaN   8 9.8
2021-03-03   7 NaN  12
Desired output:
                                                        Label
                          A                B                C
            Has data  Value  Has data  Value  Has data  Value
2021-03-01         1      5         1      7         0      0
2021-03-02         0      0         1      8         1     98
2021-03-03         1      7         0      0         1     12
 
     
    


 
     
     
    