Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pandas FutureWarning about integer indexing #1968

Merged
merged 4 commits into from
Aug 1, 2024

Conversation

NickFishr
Copy link
Contributor

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-NNNNNNN

    Github Issue SNOW-1552772: FutureWarning from Pandas about indexing in mock._pandas_util #1967

  2. Fill out the following pre-review checklist:

    • 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.

    Pandas prefers integer indexing with the .iloc[] accessor instead of implicitly assuming that an integer key is not a label but an index. It also issues a FutureWarning that in the future also integer keys will be treated as labels and not as integer index, which will most likely cause an error when this behavior is implemented.

    The former code used either used data[x] instead of data.iloc[x] or (maybe unintentionally) data.iloc[x][y] instead of data.iloc[x, y] and caused this warning.

    Not sure if an additional test is really necessary to check for warnings in the future, but I've added it anyway, please feel free to omit the test from the PR if you don't see it as necessary.

Copy link

github-actions bot commented Jul 23, 2024

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@NickFishr
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@sfc-gh-aling sfc-gh-aling merged commit 2b67c66 into snowflakedb:main Aug 1, 2024
43 of 67 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants