Skip to content

BUG: Stack creates duplicate column #39481

Closed
@soerenwolfers

Description

@soerenwolfers
import numpy as np
import pandas as pd

df = pd.DataFrame(
    np.zeros([1, 5]), 
    columns=pd.MultiIndex.from_tuples(
        [
            (0, None, None), 
            (0, 0, 0),
            (0, 0, 1),
            (0, 1, 0),
            (0, 1, 1),
        ],
    )
)

image

df.stack(2)

image


INSTALLED VERSIONS
------------------
commit           : b5958ee1999e9aead1938c0bba2b674378807b3d
python           : 3.6.6.final.0
pandas           : 1.1.5
numpy            : 1.17.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions