4cf86d33ad
### What changes were proposed in this pull request? Support dropping rows of a single-indexed DataFrame. Dropping rows and columns at the same time is supported in this PR as well. ### Why are the changes needed? To increase pandas API coverage. ### Does this PR introduce _any_ user-facing change? Yes, dropping rows of a single-indexed DataFrame is supported now. ```py >>> df = ps.DataFrame(np.arange(12).reshape(3, 4), columns=['A', 'B', 'C', 'D']) >>> df A B C D 0 0 1 2 3 1 4 5 6 7 2 8 9 10 11 ``` #### From ```py >>> df.drop([0, 1]) Traceback (most recent call last): ... KeyError: [(0,), (1,)] >>> df.drop([0, 1], axis=0) Traceback (most recent call last): ... NotImplementedError: Drop currently only works for axis=1 >>> df.drop(1) Traceback (most recent call last): ... KeyError: [(1,)] >>> df.drop(index=1) Traceback (most recent call last): ... TypeError: drop() got an unexpected keyword argument 'index' >>> df.drop(index=[0, 1], columns='A') Traceback (most recent call last): ... TypeError: drop() got an unexpected keyword argument 'index' ``` #### To ```py >>> df.drop([0, 1]) A B C D 2 8 9 10 11 >>> df.drop([0, 1], axis=0) A B C D 2 8 9 10 11 >>> df.drop(1) A B C D 0 0 1 2 3 2 8 9 10 11 >>> df.drop(index=1) A B C D 0 0 1 2 3 2 8 9 10 11 >>> df.drop(index=[0, 1], columns='A') B C D 2 9 10 11 ``` ### How was this patch tested? Unit tests. Closes #33929 from xinrong-databricks/frame_drop. Authored-by: Xinrong Meng <xinrong.meng@databricks.com> Signed-off-by: Takuya UESHIN <ueshin@databricks.com> |
||
---|---|---|
.. | ||
source | ||
make.bat | ||
make2.bat | ||
Makefile |