A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/11086 below:

Union of index with itself not invariant, sets frequency attribute · Issue #11086 · pandas-dev/pandas · GitHub

When creating the union of an index with itself, the frequency may end up being reset. I would have expected the call to union in the following example to be invariant and return the original index:

In [56]: index = pd.bdate_range('20150101', periods=10)
In [57]: index.freq = None
In [58]: index
Out[58]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2015-01-01, ..., 2015-01-14]
Length: 10, Freq: None, Timezone: None

In [59]: index.union(index)
Out[59]:
<class 'pandas.tseries.index.DatetimeIndex'>
[2015-01-01, ..., 2015-01-14]
Length: 10, Freq: B, Timezone: None

This then propagates through to e.g. combine_first, which is also not invariant. This might be desirable behavior in some cases but definitely surprising imo.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4