Skip to content

indexing #3660

@behzadnouri

Description

@behzadnouri
import pandas as pd
from numpy.random import rand
idx = pd.date_range(start='5/20/2013', end='5/21/2013')
df = pd.DataFrame({k:(100*rand(len(idx))).astype('int') for k in ['6', '36']}, index=idx)

everything looks fine:

>>> df
            36   6
2013-05-20  58  23
2013-05-21  68  31

and even this works:

>>> df['6']
2013-05-20    23
2013-05-21    31
Freq: D, Name: 6, dtype: int32

but this is one fails:

>>> df['36']
Empty DataFrame
Columns: [36, 6]
Index: []

it seems to me the problem comes from a 'DatetimeIndex', because this works fine:

>>> df.index = [d.date() for d in df.index]
>>> df['36']
2013-05-20    58
2013-05-21    68
Name: 36, dtype: int32

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions