I am a pandas rookie and I have reviewed similar questions in stackoverflow, but this seems unique.
I am looking for a function that will compare A and B and if any column in B has a value > 0 for the column, the DataFrame B will be used to create DataFrame C.
The goal is for DataFrame C the same size as DataFrame A, just with DataFrame B's values for the columns with the same label.
Have:
A = pd.DataFrame({"X1": [0], "Y1": [0], "X2": [0], "Y2": [0], "X3": [0], "Y3": [0], "X4": [0], "Y4": [0]})
B = pd.DataFrame({"X1": [9], "Y1": [99.9]})
Want:
C= pd.DataFrame({"X1": [9], "Y1": [99.9], "X2": [0], "Y2": [0], "X3": [0], "Y3": [0], "X4": [0], "Y4": [0]})
Bcontain keys not inA? Can you justfor b in B:or would that have illegal values?