Skip to content

BUG: shift() on Series of dtype bool makes dtype into object, so HDFStore won't append #4618

Closed
@bigtonylewis

Description

@bigtonylewis
import pandas as pd

# '0.11.0'
print pd.__version__

df = pd.DataFrame(index=range(0,5), columns=['mybool'])
df.mybool = False
store = pd.HDFStore('shiftedbool.h5')

# this works
store.append('noshiftedbool', df)

# now add a shifted bool, backfilled
df['shiftedbool'] = df.mybool.shift(1).fillna(method='bfill')
print df

# causes exception:
store.append('shiftedbool', df)

This can be worked around; for now I'm using 0.0 and 1.0. But this seems like an issue that could be improved.

My first issue submitted; I hope it's up to scratch

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsDuplicate ReportDuplicate issue or pull requestMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions