Index division by zero not filled · Issue #19322 · pandas-dev/pandas (original) (raw)
idx = pd.Index(range(5))
>>> idx
Int64Index([0, 1, 2, 3, 4], dtype='int64')
>>> idx / 0
Int64Index([0, 0, 0, 0, 0], dtype='int64')
>>> idx // 0
Int64Index([0, 0, 0, 0, 0], dtype='int64')
>>> idx % 0
Int64Index([0, 0, 0, 0, 0], dtype='int64')
>>> divmod(idx, 0)
(Int64Index([0, 0, 0, 0, 0], dtype='int64'), Int64Index([0, 0, 0, 0, 0], dtype='int64'))
>>> idx.astype('uint64') / 0
UInt64Index([0, 0, 0, 0, 0], dtype='uint64')
>>> idx.__truediv__(0)
Float64Index([nan, inf, inf, inf, inf], dtype='float64')
>>> idx.astype('float64') / 0
Float64Index([nan, inf, inf, inf, inf], dtype='float64')