如何使用loc或在pd.DataFrame中选择反索引iloc?
loc
iloc
我尝试了df.loc[!my_index,my_feature]但是失败了。
df.loc[!my_index,my_feature]
而且df.loc[[ind for ind in df.index.tolist() if ind not in my_index],my_feature]看起来太呆板了。有更好的主意吗?
df.loc[[ind for ind in df.index.tolist() if ind not in my_index],my_feature]
python indexing dataframe pandas
dataframe ×1
indexing ×1
pandas ×1
python ×1