Skip to content

How to approach add_nested with mismatched index #42

Closed
@dougbrn

Description

@dougbrn

add_nested currently works as a left join from the perspective of the base layer, as shown below:

# unmatched nested objects are removed
>>> base = NestedFrame({"a":[1,2,3]}, index=[0,1,2])
>>> nested = NestedFrame({"b":[1,2,3,4]}, index=[0,1,2,3])

>>> base.add_nested(nested, "nested")
	a	nested
0	1	b 0 1
1	2	b 0 2
2	3	b 0 3
# unmatched base rows are kept
>>> base = NestedFrame({"a":[1,2,3]}, index=[0,1,2])
>>> nested = NestedFrame({"b":[1,2,3,4]}, index=[0,1,3,3]) # no match for index=2

>>> base.add_nested(nested, "nested")
	a	nested
0	1	b 0 1
1	2	b 0 2
2	3	None

Is this the best default behavior? Should we add various join options to the output of this operation? For time-domain purposes, I can see value in keeping nested lightcurves even when no object information is present

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions