resample() with how=count causes Segmentation Fault · Issue #10228 · pandas-dev/pandas (original) (raw)

Runing the code as is below results in a segmentation fault when it gets to resample()
The first pass runs, and then either the 2nd or 3rd run produces:

Segmentation fault: 11

It happens on:

It does not happen on:

Those are the only ones I've tested

import pandas as pd

frame = pd.DataFrame({'delay_category': {pd.Timestamp('2014-05-18 08:50:00'): 'yes',
  pd.Timestamp('2014-05-19 14:35:00'): 'yes',
  pd.Timestamp('2014-05-22 08:45:00'): 'yes',
  pd.Timestamp('2014-05-27 10:00:00'): 'no',
  pd.Timestamp('2014-05-28 11:05:00'): 'no'}})

frame_filter = frame[frame['delay_category'] == 'da']['delay_category']

for i in range(1,10):
    frame_filter.resample('d', how='count')

Setting how=sum also does not result in the issue.

It only happens after the frame has been selected with a parameter that doesn't work, resulting in an empty series.
Eg. this works fine:

frame_filter = frame[frame['delay_category'] == 'yes']['delay_category']

for i in range(1,10):
    frame_filter.resample('d', how='count')