Skip to content

Int64Index and pivot_table #678

@dieterv77

Description

@dieterv77

I found an issue related to having an Int64Index and using pivot_table.

Here's the code that illustrates the problem:

Start code

import itertools
import datetime
import pandas

d = datetime.date.min
data = list(itertools.product(['foo', 'bar'], ['A', 'B', 'C'],['x1', 'x2'],[d + datetime.timedelta(i) for i in xrange(20)], [1.0]))

print data[0]
df = pandas.DataFrame(data)

df2 = pandas.pivot_table(df, values=4, rows=[0,1,3],cols=[2])
print df2.columns

df = df.rename(columns=lambda x: str(x))
df2 = pandas.pivot_table(df, values='4', rows=['0','1','3'],cols=['2'])
print df2.columns

end code

I would expect the columns of the pivoted table to be the same regardless of whether the column index of the original table
is ints or strings. I'm finding that this is not the case.

thanks in advance for looking into it.

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