Skip to content

truncate() raises IndexError on large timeseries #11382

Closed
@saroele

Description

@saroele

Hi,

I found a bug, tested on pandas 0.16 and 0.17. On large time series, the truncate() method throws an IndexError. Here's code that reproduces the bug:

>>> import pandas as pd

>>> # Works fine on small timeseries:
>>> small = pd.Series(data=range(int(2e3)), index=range(int(2e3)))
>>> small.truncate()
>>> small.truncate(before=0, after=3e3)

>>> # IndexError thrown on large timeseries:
>>> big = pd.Series(data=range(int(2e6)), index=range(int(2e6)))
>>> big.truncate()
>>> big.truncate(before=0, after=3e6)

Info version:

INSTALLED VERSIONS

commit: None
python: 2.7.8.final.0
python-bits: 64
OS: Linux
OS-release: 3.16.0-41-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8

pandas: 0.17.0
nose: 1.3.4
pip: 7.1.2
setuptools: 5.5.1
Cython: 0.20.2
numpy: 1.8.2
scipy: 0.14.0
statsmodels: None
IPython: 3.0.0
sphinx: 1.2.2
patsy: None
dateutil: 2.4.2
pytz: 2015.6
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.3.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.3.2
html5lib: None
httplib2: 0.9
apiclient: None
sqlalchemy: 0.9.7
pymysql: None
psycopg2: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypeError ReportingIncorrect or improved errors from pandasTestingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions