Segfault when modifying pandas.DataFrame in-place after creating from numpy recarray · Issue #6026 · pandas-dev/pandas (original) (raw)
The following code generates a segfault when use_records
is True. This segfault only occurs when the DataFrame is generated from a record array and then I attempt to modify the series in-place. This was not an issue in the previous release (v0.12) of Pandas. Tested this code against 0.13.0-268-g08c1302.
import numpy as np
import pandas
data = [('right', 'left', 'left', 'left', 'right', 'left', 'timeout')]
use_records = True
if use_records:
recarray = np.rec.fromarrays(data, names=['response'])
df = pandas.DataFrame(recarray)
else:
df = pandas.DataFrame({'response': data[0]})
mask = df.response == 'timeout'
df.response[mask] = 'none'