You have several options. If you consider your single column DataFrames as Series, you could simply concat and mean on axis=1 (which ignores the NaNs by default):
out = pd.concat([df1[0], df2[0]], axis=1).mean(axis=1)
Output:
0 4.5
1 3.5
2 NaN
3 4.0
4 5.0
5 9.0
dtype: float64
If you potentially have multiple columns, you could manually compute the mean by computing the sum and dividing by the number of non-NaN:
out = df1.add(df2, fill_value=0).div(df1.notna().astype(int)+df2.notna())
Or, for a more generic option that could also handle an arbitrary number of DataFrames as input, using concat+groupy.mean:
out = pd.concat([df1, df2]).groupby(level=0).mean()
Output:
0
0 4.5
1 3.5
2 NaN
3 4.0
4 5.0
5 9.0
timings
Using one column for each of the two DataFrames and a random choice of numbers or NaN.
