Skip to content

itertuples() fails after selecting a column twice #3873

@gtakacs

Description

@gtakacs

The following code gives incorrect result (using pandas 0.11):

import pandas
df = pandas.DataFrame(data={"a": [1, 2, 3], "b": [4, 5, 6]})
print df[["a", "a"]].values # works
print list(df[["a", "a"]].itertuples()) # FAILS!

The last lines prints [(0, 'a', 'a'), (1, 'a', 'a')] instead of [(0, 1, 1), (1, 2, 2), (2, 3, 3)].

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @cpcloud@gtakacs

      Issue actions

        itertuples() fails after selecting a column twice · Issue #3873 · pandas-dev/pandas