I would like to have in python the same behavior as the MATLAB function outerjoin
.
I've been using pandas.merge
, but the result is different in case of having NaNs.
matlab
t1 = table([24;25], [NaN;10], 'VariableNames',{'a50','a36'});
t2 = table([NaN;10], 'VariableNames',{'a36'});
t = outerjoin(t1,t2,'MergeKeys',true,'Type','Right')
a50 a36
___ ___
25 10
NaN NaN
python
import numpy as np
import pandas as pd
t1 = pd.DataFrame({'a50': [24,25], 'a36': [np.nan, 10]})
t2 = pd.DataFrame({'a36': [np.nan, 10]})
t = pd.merge(t1, t2, how='right')
a50 a36
___ ___
24 NaN
25 10.0
Any other alternative? Thanks