BUG: Series.get() on ExtensionArray series (and Categorical) indexed by integer returns incorrect result #20882
Labels
ExtensionArray
Extending pandas with custom dtypes or arrays.
Indexing
Related to indexing on series/frames, not to indexes themselves
Milestone
Code Sample, a copy-pastable example if possible
Problem description
In the above,
sb
is a standardSeries
andsb.get(4)
returns the element with index value 4. But forsa
, which is backed by anExtensionArray
, it is returning the 4th element of the array.For the series
s
containingCategorical
,s.get(2)
is returning the 3rd element of the array, rather than the second.Expected Output
sa.get(4)
should beDecimal('2')
For the
Categorical
example,s.get(2)
should return'b'
, similar to the expressions2.get(2)
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.0.dev0+811.g4afc75638
pytest: 3.4.0
pip: 9.0.1
setuptools: 38.5.1
Cython: 0.25.1
numpy: 1.14.1
scipy: 1.0.0
pyarrow: 0.8.0
xarray: None
IPython: 6.2.1
sphinx: 1.7.1
patsy: 0.5.0
dateutil: 2.6.1
pytz: 2018.3
blosc: 1.5.1
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.2.0
openpyxl: 2.5.0
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.5
pymysql: 0.8.0
psycopg2: None
jinja2: 2.10
s3fs: 0.1.3
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: