import pandas as pd
# 创建第一个 DataFrame
df1 = pd.DataFrame({'A': [1, 2, 3, 4, 5],
'B': [6, 7, 8, 9, 10],
'C': [11, 12, 13, 14, 15]})
# 创建第二个 DataFrame
df2 = pd.DataFrame({'D': [16, 17, 18, 19, 20],
'E': [21, 22, 23, 24, 25],
'F': [26, 27, 28, 29, 30]})
# 计算每个 DataFrame 的计数
count_df1 = pd.DataFrame(df1.count()).rename(columns={0: 'Count_df1'})
count_df2 = pd.DataFrame(df2.count()).rename(columns={0: 'Count_df2'})
# 执行左连接
result = pd.merge(count_df1, count_df2, left_index=True, right_index=True, how='left')
# 显示结果
print(result)