Closed
Description
Similar to #4746, trying to resample
with an index containing NaT
produces rather ambiguous error messages of the form:
ValueError: Shape of passed values is (2, 5), indices imply (2, 4)
Something like cannot resample from index containing Not-a-Time (NaT)
would be more helpful to users.
MWE
import pandas as pd
import numpy as np
times = pd.DatetimeIndex(['20160428T110000',
'20160428T110001',
'20160428T110002',
'20160428T110003',
'20160428T110004',
pd.NaT,
'20160428T110001',
'20160428T110002',
'20160428T110003',
'20160428T110004'])
df = pd.DataFrame(np.random.randn(10,2),
index=times,
columns=['A', 'B'])
df.resample('3s')
This example index contains duplicate values, but results are the same w/ or w/o them.
output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 32
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 23 Stepping 10, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
pandas: 0.15.2
nose: 1.3.4
Cython: 0.21.1
numpy: 1.8.2
scipy: 0.14.0
statsmodels: 0.6.1
IPython: 2.3.1
sphinx: 1.2.3
patsy: 0.3.0
dateutil: 2.3
pytz: 2014.10
bottleneck: None
tables: 3.1.1
numexpr: 2.4
matplotlib: 1.4.2
openpyxl: None
xlrd: 0.9.3
xlwt: None
xlsxwriter: 0.6.4
lxml: 3.4.1
bs4: 4.3.2
html5lib: None
httplib2: None
apiclient: None
rpy2: 2.5.2
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None