SEPURI-SAI-KRISHNA commented on PR #45083:
URL: https://github.com/apache/superset/pull/45083#issuecomment-6057892618
Thanks for digging out the provenance, that is a better argument for this
change than the one in the description. Confirmed:
```python
base_df = DataFrame({"y": [1, 2], "z": [3, 4]})
append_df = DataFrame({"y": [10, 20]})
base_df.assign(**{"z": append_df["y"]})
# y z
# 0 1 10
# 1 2 20
```
Pre-#19116 `assign` gives exactly what this PR gives, `['y', 'z']` with `z`
overwritten, so this is a restore rather than a new contract. I will add that
to the description.
Worth noting the condition has to test both halves, which I had wrong at
first. `assign` keyed on nothing but the target label, and the closest single
test to that is `value in base_df.columns`. That one is not enough, because the
geography operations pass `append_df`'s own column names as keys:
`geodetic_parse` passes `{"latitude": "latitude"}` when the caller keeps the
default name, and `latitude` is in neither frame's overlap. Presence-only sends
it to `concat`, which unions the index, so a non-0-based frame gains a row per
parsed row. Hence `value != key and value not in base_df.columns`, with a test
for that case.
On nothing relying on the duplicates, that matches what I found. The one
thing in the repo that reads a label back is `flatten`, and it goes through
`df.columns` rather than `df[label]`, so it is indifferent.
Separately, your `assign` point explains the other half of what the bot
flagged on #45018. `assign` aligns on the index, so the geography operations'
bare `DataFrame()` used to produce silently null coordinates; #19116's `concat`
turned that into extra rows too. Same root cause, older than the row count
symptom. That one is #45085 with a fix in #45086.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]