Repository navigation
fix: use Series.iloc for positional access in generate_join_column - #40936
Merged
Merged
Conversation
Silences pandas FutureWarning: Series.__getitem__ treating integer keys as positional is deprecated; use .iloc[pos] for explicit position access.
Contributor
|
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR). |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #40936 +/- ##
=======================================
Coverage 64.17% 64.17%
=======================================
Files 2654 2654
Lines 143763 143763
Branches 33161 33161
=======================================
Hits 92255 92255
Misses 49890 49890
Partials 1618 1618
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Silences a pandas
FutureWarningthat fires on every chart render using time-shift joins:Source:
superset/models/helpers.py—ExploreMixin.generate_join_columnChange
df.apply(..., axis=1)produces apd.Seriesper row whose index labels are the DataFrame column names (always strings from SQL result sets).row[0]was being resolved positionally, which pandas now warns against..iloc[column_index]is the explicit positional API and matches the original intent exactly.No behavior change
row[0]androw.iloc[0]return the same value for any DataFrame whose columns are string-labeled (the only case that can reach this code path). This is a pure deprecation fix.Test plan
tests/unit_tests/common/test_time_shifts.pycovergenerate_join_columnvia all four time grains and pass on this branch.