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/10149 below:

Index.union cannot handle array-likes · Issue #10149 · pandas-dev/pandas · GitHub

Skip to content Navigation Menu

Saved searches Use saved searches to filter your results more quickly

Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Additional navigation options

BUG: Index.union cannot handle array-likes  #10149

Description

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