小编Tes*_*est的帖子

如果所有行的列中只有一个值,则折叠Pandas数据框中的行

我跟随DF

         col1  |  col2   | col3   | col4   | col5  | col6
    0    -     |   15.0  |  -     |  -     |   -   |  -
    1    -     |   -     |  -     |  -     |   -   |  US
    2    -     |   -     |  -     |  Large |   -   |  -
    3    ABC1  |   -     |  -     |  -     |   -   |  -
    4    -     |   -     |  24RA  |  -     |   -   |  -
    5    -     |   -     |  -     |  - …
Run Code Online (Sandbox Code Playgroud)

python rows collapse dataframe pandas

5
推荐指数
1
解决办法
800
查看次数

标签 统计

collapse ×1

dataframe ×1

pandas ×1

python ×1

rows ×1