-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SNOW-1642293 Add support for lazy index labels in reindex and fix rei…
…ndex name bug (#2175) <!--- Please answer these questions before creating your pull request. Thanks! ---> 1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR. <!--- In this section, please add a Snowflake Jira issue number. Note that if a corresponding GitHub issue exists, you should still include the Snowflake Jira issue number. For example, for GitHub issue #1400, you should add "SNOW-1335071" here. ---> Fixes SNOW-1642293 2. Fill out the following pre-review checklist: - [x] I am adding a new automated test(s) to verify correctness of my new code - [ ] If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing - [ ] I am adding new logging messages - [ ] I am adding a new telemetry message - [ ] I am adding new credentials - [ ] I am adding a new dependency - [ ] If this is a new feature/behavior, I'm adding the Local Testing parity changes. 3. Please describe how your code solves the related issue. 1. Added support for using lazy index labels with reindex. ```py >>> ser = pd.Series([1, 2, 3], index=["A", "B", "C"]) >>> idx = pd.Index(["X", "Y", "Z"]) >>> ser.reindex(idx) X NaN Y NaN Z NaN dtype: float64 ``` 2. `reindex` has a bug - if it is performed with an index `idx` which has a name, it does not update the result series'/df's index name accordingly. The name remains None. For instance, ```py >>> ser = pd.Series([0, 1, 2], index=list("ABC"), name="test") >>> idx = native_pd.Index(list("CAB"), name="weewoo") >>> snow_series.reindex(index=idx) C 2 A 0 B 1 Name: test, dtype: int64 # Instead of: weewoo C 2 A 0 B 1 Name: test, dtype: int64 ``` 3. Fixed a bug where `Index` objects name was not set correctly during binary operations. --------- Co-authored-by: Andong Zhan <[email protected]>
- Loading branch information
1 parent
afbc6f6
commit 71a2182
Showing
5 changed files
with
95 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters