The attempt to disambiguate between loc and iloc with pandas objects fails when the index is integer-valued.
>>> import scprep
>>> import pandas as pd
>>> X = pd.DataFrame([[0], [1], [2], [3], [4]])
>>> Y = X.iloc[[0, 2, 3]]
>>> scprep.select.select_rows(Y, idx=[0, 1])
/home/scottgigante/.local/lib/python3.7/site-packages/scprep/select.py:466: FutureWarning:
Passing list-likes to .loc or [] with any missing label will raise
KeyError in the future, you can use .reindex() as an alternative.
See the documentation here:
https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#deprecate-loc-reindex-listlike
data = data.loc[idx]
0
0 0.0
1 NaN
Desired output would be to treat [0,1] as an attempt to iloc.
Worse still is the case when indices are not missing, but out of order. What is the desired output of the following? An ambiguity warning, probably.
The attempt to disambiguate between
loc
andiloc
with pandas objects fails when the index is integer-valued.Desired output would be to treat [0,1] as an attempt to
iloc
.Worse still is the case when indices are not missing, but out of order. What is the desired output of the following? An ambiguity warning, probably.