Skip to content

Generic alignment function and new module core.align #4336

Closed
@cpcloud

Description

@cpcloud

A new module core.align would hold a couple of generic alignment functions, one of which will be align_multiple or possibly align2 (taking 2 pandas objects) and then align would take a sequence of pandas objects to align.

Need to think about the API a bit more.

Psuedocode-ish:

df = DataFrame(...)
df2 = DataFrame(...) # possibly different index and columns than df
s = Series(...)
result = pd.align([df, df2, s], how='outer') # compute the union of the indexes

# smoke test 1
result.columns == df.columns.join(df2.columns, how='outer').join(s.index, how='outer')
result.index == df.index.join(df2.index, how='outer')

result2 = pd.align([df, df2, s], how='inner') # intersection

# smoke test 2
result2.columns == df.columns.join(df2.columns).join(s.index)
result2.index == df.index.join(df2.index)

input with Index types would return the union/intersection of the objects. not clear what would happen if aligning an Index and another non-Index pandas object

Metadata

Metadata

Assignees

Labels

API DesignInternalsRelated to non-user accessible pandas implementation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions