Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resample() with how=count causes Segmentation Fault #10228

Closed
kelvin22 opened this issue May 29, 2015 · 4 comments
Closed

resample() with how=count causes Segmentation Fault #10228

kelvin22 opened this issue May 29, 2015 · 4 comments
Labels
Bug Resample resample method
Milestone

Comments

@kelvin22
Copy link

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:

  • Python 2.7.9 and Pandas 0.16.1
  • Python 3.4.3 and Pandas 0.16.1

It does not happen on:

  • Python 2.7.9 with Pandas 0.12.0

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')

@kelvin22
Copy link
Author

Probably related: #8573

@jreback
Copy link
Contributor

jreback commented May 29, 2015

yep, looks like a bug. pull-requests are welcome.

@jreback jreback added Bug Resample resample method labels May 29, 2015
@jreback jreback added this to the Next Major Release milestone May 29, 2015
@Garrett-R
Copy link
Contributor

@kelvin22, great bug report! Very easy to reproduce.

@jreback
Copy link
Contributor

jreback commented Jun 26, 2015

closed by #10337

@jreback jreback closed this as completed Jun 26, 2015
yarikoptic added a commit to neurodebian/pandas that referenced this issue Jul 2, 2015
* commit 'v0.16.2-49-g3908ad5':
  DOC: release note for pandas-dev#9607, as_blocks copy arg
  ENH: allow as_blocks to take a copy argument (pandas-dev#9607)
  BUG: pandas-dev#10228 resampling empty Series caused segfaults
  BUG #GH10425 test_categorical big-endian fix
  BUG: xref pandas-dev#10428, need platform_int as indexer
  ENH: GH10378 Pass kwargs to interpolation methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Resample resample method
Projects
None yet
Development

No branches or pull requests

3 participants