如何合并数据框中的n行,直到找到一个数字?

时间:2019-05-19 15:51:21

标签: pandas

0   NaN       Aggregate Limit of     ...                 NaN  Aggregate L
1   NaN                      NaN     ...        Each Retired          NaN
2   NaN  Liability for  Insuring     ...                 NaN   ALL Retire
3   NaN                      NaN     ...         Independent          NaN
4   NaN   Clauses A, B, C and E)     ...                 NaN    Independe
5   NaN                      NaN     ...           Director:          NaN
6   NaN                      NaN     ...                 NaN   Directors:
7   NaN               $5,000,000     ...            $500,000   $2,500,000

我想将所有行合并到数字行,然后用合并的行创建标题,因此结果看起来像

以下是我的预期输出

,保险条款A,B,C和E的总责任限额,保留,担保人衍生要求的次限额:,每个退休独立董事的单独限额:,LALL RetireIndependeDirector总计: ,$ 5,000,000,$ 1,000,000,$ 350,000,$ 500,000,$ 2,500,000

标题不相同,根据表的不同可以不同。

0 个答案:

没有答案