Though API doc says Index.union
can accept Index
or array-like, it raises errors.
import numpy as np
import pandas as pd
idx = pd.Index([1, 2, 3])
idx.union([2, 3, 4])
# AttributeError: 'list' object has no attribute 'dtype'
idx.union(pd.Series([2, 3, 4]))
# AttributeError: 'Series' object has no attribute 'is_monotonic'
idx.union(np.array([2, 3, 4]))
# AttributeError: 'numpy.ndarray' object has no attribute 'is_monotonic'
NOTE: intersection
looks OK.
idx.intersection([2, 3, 4])
# Int64Index([2, 3], dtype='int64')
idx.intersection(pd.Series([2, 3, 4]))
# Int64Index([2, 3], dtype='int64')
idx.union([2, 3, 4])
# Int64Index([2, 3], dtype='int64')
You can’t perform that action at this time.
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