Series.asof not preserving dtype (original) (raw)

Code Sample, a copy-pastable example if possible

from pandas import Series
from datetime import date

if __name__ == "__main__":
    series  = Series([True, False, True], index=[date(2017,1,1), date(2017,2,1), date(2017,3,1)])

    print series.dtype, series.asof([date(2017,4,1)]).dtype

Problem description

With Pandas 0.19.2, I found that dtype was not preserved with asof (bool -> float64), whereas older version of Pandas (ex: version 0.18.0), was preserving bool type

Expected Output

bool, bool

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.12.final.0 python-bits: 64 OS: Windows OS-release: 7 machine: AMD64 processor: Intel64 Family 6 Model 44 Stepping 2, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None

pandas: 0.19.2
nose: 1.3.7
pip: 8.1.2
setuptools: 23.0.0
Cython: 0.23.4
numpy: 1.12.1
scipy: 0.19.0
statsmodels: 0.8.0
xarray: None
IPython: 4.0.1
sphinx: None
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: 2.6.2
matplotlib: 2.0.0
openpyxl: 2.3.4
xlrd: None
xlwt: None
xlsxwriter: None
lxml: 3.6.1
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None
None