For the sample you have provided this would give the desired output. Basically transposing, backfilling empty values, then slicing and concatenating to get the final result.
import pandas as pd
import numpy as np
df = pd.DataFrame(
{'A': {0: 'X', 1: 'Y', 2: np.nan},
'B': {0: np.nan, 1: 'value', 2: 'Z'},
'C': {0: np.nan, 1: np.nan, 2: 'SOMETHING'}})
df = df.T.bfill()
df = pd.concat([df.iloc[:1,:3].reset_index(drop=True),
df.iloc[-1:,-1:].reset_index(drop=True)],
axis=1)
df.columns = ['A','B','C','D']
Output
A B C D
0 X Y Z SOMETHING
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…