Summary

Passing 'nunique' to resample produces incorrect output. However, passing pd.Series.nunique works.

Code Sample, a copy-pastable example if possible

import pandas as pd
from pandas import Timestamp

time = [Timestamp('2016-06-28 09:35:35'), Timestamp('2016-06-28 16:09:30'), Timestamp('2016-06-28 16:46:28')]
data = ['1', '2', '3']
test = pd.DataFrame({'time':time, 'data':data})
display(test.set_index('time').resample('H').apply({'data':'nunique'}))
display(test.set_index('time').resample('H').apply({'data':pd.Series.nunique}))

Expected Output

(INCORRECT, in bold) 2016-06-28 09:00:00 1 2016-06-28 10:00:00 0 2016-06-28 11:00:00 0 2016-06-28 12:00:00 0 2016-06-28 13:00:00 0 2016-06-28 14:00:00 0 2016-06-28 15:00:00 0 2016-06-28 16:00:00 1

(CORRECT, in bold) 2016-06-28 09:00:00 1 2016-06-28 10:00:00 0 2016-06-28 11:00:00 0 2016-06-28 12:00:00 0 2016-06-28 13:00:00 0 2016-06-28 14:00:00 0 2016-06-28 15:00:00 0 2016-06-28 16:00:00 2

output of pd.show_versions()

INSTALLED VERSIONS

commit: None python: 2.7.10.final.0 python-bits: 64 OS: Linux OS-release: 4.1.10-17.31.amzn1.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8

pandas: 0.18.1 nose: 1.3.7 pip: 8.1.2 setuptools: 20.3.1 Cython: 0.24 numpy: 1.11.1 scipy: 0.17.1 statsmodels: 0.6.1 xarray: None IPython: 4.1.2 sphinx: None patsy: 0.4.1 dateutil: 2.5.3 pytz: 2016.4 blosc: None bottleneck: None tables: None numexpr: 2.6.0 matplotlib: 1.5.1 openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: None httplib2: None apiclient: None sqlalchemy: None pymysql: None psycopg2: 2.6.1 (dt dec pq3 ext) jinja2: 2.8 boto: 2.40.0 pandas_datareader: None

Comment From: jreback

looks like the same as #13453

Comment From: agtsai-i

Wasn't quite sure, so I submitted anyways