take_1d yields surprising results when working with SparseArray #19506
Code Sample, a copy-pastable example if possible
import pandas as pd import numpy as np import pandas.core.algorithms as algos algos.take_1d(pd.SparseArray([0,0,1], fill_value=0), [0,1,2]) #=> array([ 1, 23618416, 32]) # VS algos.take_1d(np.array([0,0,1]), [0,1,2]) #=> array([0,0,1])
This to me smells like a problem with SparseArray sending over a sparse representation to take_1d in the C code. I would expect these values to be the same.
I would expect them to be the same.