Skip to content

BUG: concat DatetimeIndex freq depends on input order (GH#64253)#66295

Open
gaurav0107 wants to merge 1 commit into
pandas-dev:mainfrom
gaurav0107:fix/64253-concat-order-affects-index-freq
Open

BUG: concat DatetimeIndex freq depends on input order (GH#64253)#66295
gaurav0107 wants to merge 1 commit into
pandas-dev:mainfrom
gaurav0107:fix/64253-concat-order-affects-index-freq

Conversation

@gaurav0107

Copy link
Copy Markdown

pd.concat(..., axis=1) over objects whose indexes share a non-inferable
frequency (e.g. CustomBusinessDay) produced a combined index whose .freq
depended on the order of the inputs: a pairwise union can drop the shared
frequency in an intermediate, gappy step, and because CustomBusinessDay
cannot be recovered by inferred_freq it was never restored even after the
final union made the index regular again.

The combination path now reattaches the shared frequency when every input shares
a single frequency and the combined index is exactly regular with respect to it
(verified via a date_range equality check), so the result no longer depends
on input order. Index values and dtype are never modified; genuinely gappy or
mixed-frequency unions are left with freq=None as before.

@gaurav0107 gaurav0107 marked this pull request as ready for review July 11, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: The order of items in pd.concat matters for the resulting .index.freq.

1 participant